Re: Few questions about concurrency

2016-08-28 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2016-08-27 at 07:30 +, Suliman via Digitalmars-d-learn wrote: > […] > > 1. There is OS threads. Context-switching is very expensive  > because during it we should to save ALL CPU registers to RAM.  > Accessing to RAM is slowly up 200-300 times then accessing to  > registers, so

Re: Few questions about concurrency

2016-08-27 Thread rikki cattermole via Digitalmars-d-learn
On 28/08/2016 3:36 AM, Suliman wrote: Message passing is an alternative to relying on globals + mutex's. In the end its implemented by a global + stack FIFO (mailbox). Where it's better? Could you give an example? It is my personal goto when dealing with some form of event loop. Since you

Re: Few questions about concurrency

2016-08-27 Thread Suliman via Digitalmars-d-learn
Message passing is an alternative to relying on globals + mutex's. In the end its implemented by a global + stack FIFO (mailbox). Where it's better? Could you give an example? Ring transition e.g. system calls are not all that expensive. Its what the kernel does with that system call that is

Re: Few questions about concurrency

2016-08-27 Thread rikki cattermole via Digitalmars-d-learn
On 27/08/2016 7:30 PM, Suliman wrote: Hello! I am still attempt to better understand how concurrency works. I read a lot of info but still misunderstood some key-points. Here is my thought about it and questions: 1. There is OS threads. Context-switching is very expensive because during it we

Few questions about concurrency

2016-08-27 Thread Suliman via Digitalmars-d-learn
Hello! I am still attempt to better understand how concurrency works. I read a lot of info but still misunderstood some key-points. Here is my thought about it and questions: 1. There is OS threads. Context-switching is very expensive because during it we should to save ALL CPU registers to