UNISA Chatter – Operating System Concepts: Part 3 … Processes


See UNISA – Summary of 2010 Posts for a list of related UNISA posts, whereby I have just received the schedule for my other two subjects “Formal Logic” and “Advanced Programming” … I will hardly have any weekend available to relax away from the digital ecosystem this year and cannot wait for November when this interesting, yet challenging part-time study adventure will come to an end. Well, in this post we briefly cover the the world of processes within an operating system.

What is a Process?

A process is one of the main entities that an operating system needs to care about and is essentially synonymous with a program. A process goes through a range of states during its lifetime, as shown in the illustration, starting with new, ready, running, waiting and terminated. The two main queues that harbour the process are the “ready queue” and  the “I/O request” queue. The former contains all processes that are eager and ready to execute, but are waiting to get access to the CPU play area. The latter is a queue that accommodates processes that make requests to shared devices, such as secondary storage.

Picscan0001[1]

The illustration also shows a Process Control Block (PCB), which is is a representation of each process. Note that a PCB is also known as a task control block. If we are working in a Windows environment we have a platter of tools available to peek into the world of processes. The Process Explorer from www.sysinternals.com allows us to show detailed information on all processes within the system and zoom into a specific process, such as process id 1296 named GrooveMonitor.exe, whereas the WinDBG debugger (window on the right) allows us to not only view the same information, but attach to and debug the process.

image

Process scheduling is a core service that the operating system needs to deliver. Tasks such as keeping track of all processes, switching context as processes the CPU is switched from one process to another and  actual job scheduling are all fascinating services. Three common schedulers are the long-term scheduler, the medium-term scheduler and  yes, you have guessed right, the short-term scheduler.

  • Long-term scheduler … selects processes from the pool of processes, typically batch jobs, that have been queued to a mass-storage device, where they are stored for execution.
  • Medium term-scheduler … swaps processes out of memory  and reintroducing it when appropriate. This scheduler is useful in operating systems where memory resources are scarce and the overhead of swapping is a lower taxation than the memory utilisation.
  • Short-term scheduler … selects processes that are ready to execute and allocates the CPU. This scheduler is also referred to as the CPU scheduler.

In a UNIX system you would create a process using the fork() system call to create a child process, make copies of the stack and the heap and a shared memory for easy communication. After the fork() you call exec() to load a binary file into memory and thereby bringing a program to life. In a Windows environment the two calls are achieved by the one CreateProcess() Win32 API call.

What are some of the challenges we need to address in an operating system?

When we have an operating system that does not support concurrent processing, for example a handheld or my personal brain, the operating system needs to implement a mechanism that allows several processes to gain access to the system, controlling processes that do not surrender their running mode voluntarily and processes that start eating up resources beyond their allowed quotas. In addition the kernel needs special logic to ensure that no deadlock can occur by two processes waiting on each other and thus unable to switch effectively.

Clipart Illustration of Four Orange People Holding Hands And Standing On Connected Green Puzzle Pieces, With Thought Clouds Above Them How do Processes communicate?

Finally we can take a brief look at the options of communication between processes, which include message passing and shared memory communication models. The latter requires a region of shared memory and synchronization if both processes are going to be writing to the shared memory. The message passing environment requires the operating system to implement at least a send() and a write() operations, with the choice of variable-sized or fixed-sized messages.

Some of the common inter-process and client-server communication mechanisms include:

  • Shared Memory
  • Sockets, which define end points and connections between processes that consist of a pair of sockets, one at either end of the communication channel.
  • Local procedure calls (LPC), which are based on the RPC mechanism, but optimised when calls are made to the local system.
  • Remote procedure calls (RPC), which are calls to a procedure in a process on a remote system
  • Pipes, which allow communication between parent and child processes.
  • Named Pipes, which are an advanced version and allow unrelated processes to communicate.

Our community book “.NET Enterprise Solutions – Interoperability for the Connoisseur”, as mentioned in What is ALM and are the relevant publications too dry for the developers?, explores and introduces samples on most of these mechanisms and others, such as Windows Communication Foundation (WCF).

Next on the menu is a species that lives in the same environment as Processes … “Threads”.

Acronyms Used
| I/O – Input / Output | LPC – Local procedure Call | PCB – process Control Block | RPC – Remote Procedure Call | WCF – Windows Communication Foundation |

Comments (0)

Skip to main content