The Scheduler

The task of choosing which process gets swapped out is undertaken by process 0 (the sched process, which is part of the Solaris kernel). If possible, the process swapped out will be in a sleeping state so as not to interrupt one that is actually running on a CPU at the time. Once the new process is running in memory, it too could be swapped out to the swap partition to make room for another new process.

Of course, when a process has been swapped out, it is not simply left there, as it would never get a chance to run again. So the sched process also manages the swapping back in of swapped-out processes. If there is not enough room in memory to swap a process back in, then another will have to be swapped out first. This juggling of processes between memory and disk uses up system resources and can have quite an impact on the overall performance of the system. In general, the more memory you have installed, the less often a process will need to be swapped out. Of course, this is heavily dependent on what the system is actually used for.

The amount of memory is important to the performance of the system, but the size of swap space is also important. If the swap space is not big enough, you could get a situation where sched needs to swap a process out of memory, but the swap space is already full so there is no room for it. A situation like this would cause the failure of many running processes and could lead to a system crash.

In times of yore when memory was expensive and disks were not that big, the sizing of the swap space could be a rather delicate balancing act. Thankfully, nowadays systems can support larger amounts of cheap memory, and available disk sizes still seem to be growing exponentially. This makes the planning of swap space less of an issue, though it is still important and something you need to be aware of.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset