Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Time to bring out one of my favourite computing quotes once again (and it's more applicable than the last time I did :-):

A computer is a state machine. Threads are for people who can't program state machines. - Alan Cox

Processors handle commands sequentially, it is impossible for any currently existing CPU core to handle two instructions at the same time (well, this is not strictly true for SMT processors, but things get hairy enough here to ignore that for this discussion). Thus, the number of operations that can theoretically be executed at exactly the same time on your machine will be limited by the number of CPU cores on that same machine. Even then, synchronising several processes to execute exactly the same command at the same time on different cores is a hard task and likely not possible without reaching into your OS kernel (in fact, I'd be surprised if it were possible on a non-RT OS at all). Now, if (as indicated in your post) you are using "date" to confirm the processes are running at the same time this probably means you don't actually need them to run at the exact same microsecond but have a certain leeway. You'd need to tell us what you're actually trying to do and what kind of delay in execution is acceptable before we can make any sensible suggestions. If, for example, the task is non-blocking (i.e. does not involve IO) and quick, simple sequential processing in a loop may be sufficient.


All dogma is stupid.

In reply to Re: multi threading by tirwhan
in thread multi threading by mude

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-24 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found