How does a process table work in an operating system?

In the context of operating systems, how does a process table work exactly? How does it manage the processes as they move from state to state? Are What are the events that occur when a process changes states? Are running, ready and blocked the 3 general process states that my textbook is referring to below?

To implement the process model, the operating system maintains a table (an array of structures), called the process table, with one entry per process. (Some authors call these entries process control blocks.) This entry contains important information about the process' state, including its program counter, stack pointer, memory allocation, the status of its open files, its accounting and scheduling in- formation, and everything else about the process that must be saved when the process is switched from running to ready or blocked state so that it can be restarted later as if it had never been stopped.
shampouyaAsked:
Who is Participating?
 
Hamidreza VakilianSenior iOS DeveloperCommented:
Process table (which resides in RAM and accessible by the kernel) is an array of some sort of data structure (like a C++ class) which saves a complete snapshot of the process that was running. Kernel has a scheduler that is responsible for sharing the CPU(s) between processes. A scheduler uses algorithms such as round robin to distribute the CPU time between tasks. It also takes care of task priorities. (Tasks that are more prioritized will get a longer share of CPU time).
Whenever a process is unscheduled, the kernel snapshots the CPU registers and other information for that process and saves it to the process table so that it can be restored exactly to the last running state in the near future. Afterwards, scheduler selects the next task from the process table and restores it to the memory and continues the task. (In the OS literature, suspending a process and restoring another process and switching to it, is often called context switch)
The process states are:
Running: the task is scheduled and running.
Ready: the task is not scheduled.
Blocked: occurs when the process is waiting for some I/O operation. (I/O operations are extremely time consuming, therefore when a process e.g. requires disk access; the kernel unschedule it and marks it as blocked and lets other tasks go on. When the disk I/O is completed the kernel will context switch and schedules that process again)

(Generally speaking, a task and a process is the same in textbooks. But technically a process is a group of several tasks)

I hope it gave you a clearer look of kernel scheduler and process table.
0
 
gheistCommented:
Your textbook is: ISBN-13: 978-0131429383
Just read ahead and you will find the answer
0
 
shampouyaAuthor Commented:
Saying "look it up" seems to be a common response on this site for conceptual questions. I know what book I'm reading, and I read the entire chapter. I wanted to see if someone could put it into clearer words so that I could better understand the concept. If this is not a valid question, then Admin, please delete it.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
shampouyaAuthor Commented:
Understood. I'll take note and ask someone for help in person. Maybe the question should be deleted then.
0
 
gheistCommented:
In second paragraph where you say "kernel snapshots CPU registers" it should read "timer interrupt stores CPU context  in stack"
0
 
shampouyaAuthor Commented:
Excellent, thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.