Linux Today: Linux News On Internet Time.

More on LinuxToday

Process synchronisation in Linux

Apr 08, 2010, 03:02 (0 Talkback[s])
(Other stories by Swayam Prakasha)


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

[ Thanks to Linux User & Developer magazine for this link. ]

"The two fundamental concepts in a Linux operating system are processes and time slice. A process is an instance of a program that is being executed by the computer’s operating system. When we say that two computers are communicating with each other, we mean that two processes, one running on each computer, are in communication with each other. The only way a new process can be created by the Linux system is by issuing the fork() system call. We need to understand here that system calls are the entry points through which an active process can obtain the services from the kernel.

"Linux operates on the principle of time slice – every single process is given a little bit of time for its execution. If the process execution is not completed, then it will be put in a suspended mode till it gets its time slice and after that it continues its execution. The switch between different processes happens so fast that an end user will never be able to visualise it.

"Let us explain the time slice concept with an example – assume that there are two processes and Linux gives each a time slice of two seconds. When two seconds elapse for the first process, it is moved into the swap area. Now the second process starts to execute. Once its two seconds are over, it will be moved into the swap area. The first process will be reloaded and its execution begins. This switch happens every two seconds until one of the processes finishes."

Complete Story

Related Stories: