User talk:Philosopher/Nasal introspection: Difference between revisions

Jump to navigation Jump to search
m
Line 37: Line 37:
: Okay, for some reason (I just checked) I only saw ~6 threads in a test run (according to the Mac activity monitor), but the code currently committed is too much of a late-night hack :P —[[User:Philosopher|Philosopher]]
: Okay, for some reason (I just checked) I only saw ~6 threads in a test run (according to the Mac activity monitor), but the code currently committed is too much of a late-night hack :P —[[User:Philosopher|Philosopher]]
:: I think I have a solution now, will try and test it. Create them the same way, but limit the number of threads, and a thread only exits if there are no more jobs to be done, else it acquires a lock, picks up a new job / replaces the global queue with a new one, drops the lock, and starts work. Will see how it goes [[User:Philosopher|—Philosopher]] ([[User talk:Philosopher|talk]]) 18:21, 14 August 2013 (UTC)
:: I think I have a solution now, will try and test it. Create them the same way, but limit the number of threads, and a thread only exits if there are no more jobs to be done, else it acquires a lock, picks up a new job / replaces the global queue with a new one, drops the lock, and starts work. Will see how it goes [[User:Philosopher|—Philosopher]] ([[User talk:Philosopher|talk]]) 18:21, 14 August 2013 (UTC)
 
:: Yeah, you can use semaphores for that.
<hr/>
<hr/>


Line 46: Line 46:


: Yeah, it could be closure optimized, but I was thinking that a closure is the safest way, how else would it be done? —[[User:Philosopher|Philosopher]]
: Yeah, it could be closure optimized, but I was thinking that a closure is the safest way, how else would it be done? —[[User:Philosopher|Philosopher]]
:: Ideally, in a "share-nothing" fashion (if possible), where you'd have a pool of worker threads, that merely receive temporary copies of data (i.e. not to be modified), which isn't referenced otherwise, so easy to mark/reap (recursion depth-wise). This is what "message passing" is all about: reduce the amount of necessary synchronization to an absolute minimum, and otherwise have a pool of "agent" threads that process messages and that only ever communicate with other agents through messages.


<hr/>
<hr/>

Navigation menu