The PCB is a fairly large structure; a PCB for a single
process in Linux is over 350 bytes in size.
When a program is run, the process does not necessarily execute immediately. First the OS creates the PCB,
and then it adds the process to the Ready queue; the process enters the Ready state. The operating system will
select one of the Ready processes to execute, and that process will enter the Running state.
A process in the Running state will continue to run until the process completes, the OS decides that a
higher-priority process should run instead, the OS decides to give another process a chance to use the CPU for
a while (i.e., the ???time quantum,??? or ???timeslice,??? expires on the running process), or the running program
must pause to perform some I/O, wait for some resource to become available (e.g., a shared file), or receive a
message or signal from another process.
How is it that, ???the OS decides to give another process a chance to use the CPU???? There??™s only one CPU,
and the executing process has control. It seems an impossibility that the OS could have any influence at all, once
it turns the CPU over to the executing process.
The answer to this conundrum is the system clock. The OS programs the computer??™s clock to generate an
interrupt at set intervals.
Pages:
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278