barrier

GCC Inline Assembler “memory” Clobber don't prevent from re-arrange the code in ARM

时光总嘲笑我的痴心妄想 提交于 2021-02-10 06:14:04
问题 I read article about GCC Inline Assembler (http://www.ethernut.de/en/documents/arm-inline-asm.html). In this article, "memory" Clobber forces the compiler to store all cached values before and reload them after executing the assembler instructions. And it must retain the sequence. this is the example. The following code intends to multiply c with b, of which one or both may be modified by an interrupt routine. Disabling interrupts before accessing the variables and re-enable them afterwards

What are use cases of separate arrive and wait of C++20 barrier?

|▌冷眼眸甩不掉的悲伤 提交于 2020-08-07 03:34:45
问题 C++20 std::barrier has arrive_and_wait method, which is what pretty much every synchronization barrier implementation has. But it also has separate arrive and wait . I'm wondering what are the use cases. 回答1: OK, so you've got a bunch of threads that have to do some kind of synchronized tasks. These tasks are grouped into phases: the tasks from one phase will use data produced by tasks from a previous phase, and all previous phase work must be done before any next-phase work can start. Any

Least intrusive compile barrier for Java on x86

谁都会走 提交于 2020-01-14 13:31:51
问题 If I hava a Java process interacting with some other process via a shared ByteBuffer or similar, what would be the least intrusive equivalent of a compiler barrier in C/C++? No portability is required - I am specifically interested in x86. For example I have 2 processes reading and writing to an area of memory as per the pseudocode: p1: i = 0 while true: A = 0 //Write to B A = ++i p2: a1 = A //Read from B a2 = A if a1 == a2 and a1 != 0: //Read was valid Due to the strict memory ordering on

In OpenCL, what does mem_fence() do, as opposed to barrier()?

為{幸葍}努か 提交于 2020-01-02 01:04:08
问题 Unlike barrier() (which I think I understand), mem_fence() does not affect all items in the work group. The OpenCL spec says (section 6.11.10), for mem_fence() : Orders loads and stores of a work-item executing a kernel. (so it applies to a single work item). But, at the same time, in section 3.3.1, it says that: Within a work-item memory has load / store consistency. so within a work item the memory is consistent. So what kind of thing is mem_fence() useful for? It doesn't work across items,

How to prevent temporaryContext run concurrently with migratePersistentStore

北慕城南 提交于 2019-12-25 04:50:13
问题 I have a code part where I call migratePersistentStore and I want to prevent any temporaryContext to do anything in the same time, how? My idea is based on a semaphore and a dispatch_group . code A: dispatch_group_wait(dgLoadMain, DISPATCH_TIME_FOREVER) dispatch_semaphore_wait(semaLoadMain, DISPATCH_TIME_FOREVER) mainMOC!.performBlockAndWait({ mainMOC!.persistentStoreCoordinator!.migratePersistentStore(/* ... */) }) dispatch_semaphore_signal(semaLoadMain) code B: dispatch_group_enter

Register new thread to already defined barrier

北战南征 提交于 2019-12-25 00:16:45
问题 Is there a way to add a thread to already pre-defined barrier? The scenario: I have at certain point of time N threads, and the code declares the Barrier in order to handle them. The problem is, that sometimes I may need another new thread to be handled inside that barrier instance, but the barrier has already been declared with N threads only. Example: barrier = new Barrier(N, (sprint) => { Console.WriteLine($"Current sprint: {sprint.CurrentPhaseNumber}") }); After the declaration I need to

Do I need memory barrier for accessing memory modified by the thread that finished?

非 Y 不嫁゛ 提交于 2019-12-24 00:54:35
问题 [ Hereinafter, C++ terms ] I have a thread A and thread B that share access to the integer value P. Thread A initializes this value and updates it while running. Then thread A completes. Thread B waits for thread A to complete (standard OS API call, whatever OS is used) and wants to read P. Does thread B need a memory barrier to read a coherent, last set by thread A, value of P? Is there a possibility that when OS API says "thread A finished", the changes of memory it modified are not visible

Barrier doesn't set to referenceIds in constraint layout?

一世执手 提交于 2019-12-20 05:01:35
问题 hey last few days I am exploring about the constraint layout.the concept of barrier I can understand but when i implement I can't get the correct output. I want to set the barrier in the right direction to reference Id's. But barrier doesn't work.it should set for the views which are nameLabel and passionLabel. please help me. thank you in advance. This is the current output <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas

Real-life use cases of barriers (DSB, DMB, ISB) in ARM

筅森魡賤 提交于 2019-12-17 21:53:25
问题 I understand that DSB, DMB, and ISB are barriers for prevent reordering of instructions. I also can find lots of very good explanations for each of them, but it is pretty hard to imagine the case that I have to use them. Also, from the open source codes, I see those barriers from time to time, but it is quite hard to understand why they are used. Just for an example, in Linux kernel 3.7 tcp_rcv_synsent_state_process function, there is a line as follows: if (unlikely(po->origdev)) sll->sll

Barrier implementation for inter process in shared memory

随声附和 提交于 2019-12-13 04:59:19
问题 I am looking for an inter-processes barrier implementation. Processes are in shared memory (ie. on the same ndoe). Processes are MPI ones. I do not want to use the MPI_Barrier function, because the general policy for all the MPI implementation is active waiting. I want my processes sleeping as long as they wait. The restrictions: should be in C, maybe in C++ no spinlock, so it could use semaphore linux OS I am confident it exists thousands of barrier implementation, but I do not find any?!