in reply to Re^5: OT How fast a cpu to overwhelm Time::HiRes
in thread OT How fast a cpu to overwhelm Time::HiRes
Hmm, how do you measure context switches between threads? This is done in the perl process internally, so the OS doesn't know anything about them, or am I missing something?
Anyway, if I modify your code to use fork instead of threading I do not get any significant amount of process context switching in vmstat either. I assume this is because of the way the Linux scheduler works (it assigns long timeslices to CPU-bound processes and preempts them if there's a higher-priority IO-bound tasks). I'll have to figure out how to make Linux context-switch rapidly from perl.
Do you run a threaded Perl?
Yes, 5.8.4 i386-linux-thread-multi.
I modified my code to use threads instead of processes and got the minimal delay time down to 10 microseconds (from 11 with processes). So it looks like the context switch overhead for Linux Perl processes can be only minimally higher than that of Perl threads (for this benchmark, other workloads are bound to exhibit totally different behaviour). What do you get when you run my code?
No, but it would appear possible for it to happen from within the same process--under Linux and 5.6.2 at least.
Yes, I can confirm that this is true for 5.8.4 as well. So it seems to be possible to achieve duplicate identical results from Time::HiRes if
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: OT How fast a cpu to overwhelm Time::HiRes
by BrowserUk (Patriarch) on Dec 01, 2005 at 10:18 UTC | |
by tirwhan (Abbot) on Dec 01, 2005 at 14:23 UTC | |
by BrowserUk (Patriarch) on Dec 01, 2005 at 15:00 UTC | |
by tirwhan (Abbot) on Dec 01, 2005 at 15:45 UTC |