interesting question, but I am not sure I understand correctly.
threads and processes are scheduled using a software timesharing. or they might even run simultaneously with a multicore cpu.
but of course most of the time most of the processes wait for something, e.g. data returned from a disk read, user input,
a resource that is currently in use by another process (using locks, semaphors, ...) or similar.
in this case they are "sent to sleep" and will be woken up when an event for them arises, similar to an interrupt.
you might want to read a tutorial on multithreading for a programming language you know.
|