Pre-Emptive Multitasking and Protected Memory
We were talking last about GetNextEvent and loops; now let us cover how Mac OS X blows that out of the water. In the Mac OS X with the scheduler a completely new concept is introduced. The scheduler is actually a part of a module of the operating system itself called the kernel, which loads before other programs and runs the operation of the very basic actions of the operating system. With the scheduler, a program can be written to have no interface elements at all, and therefore leave the user with complete control of the OS and computer.
In Mac OS X, when you run a program, the scheduler is in charge and allots a certain amount of processor time to that application. Since the scheduler is in total control, it is up the scheduler to decide when that particular applications time is up, whereupon it takes back the control of the CPU, and lets the next program to start initiating code. Here is where the scheduler can pre-empt any application it wants to. With this pre-emptive action, Mac OS X begins a new layer of direction between the program and the microprocessor. Thankfully, this allows other things to take place, good things!
Ok, so we understand now that thanks to scheduler, the OS can pre-empt any application from using resources not allocated to it, or go beyond any designated time constraints. Now let us see how this affects memory. By design, all memory activity must be very strictly monitored in order for the scheduler to work. Hence, as a programs code is run, certain safeguards are made to make certain that the programs memory usage stays within the designated limits. So that if an application attempts to write any data inside some other programs allocated space, or if one program interferes with the actions of any essential system resources, it will be stopped. This is how the concept of protected memory works.
The fusion of both pre-emptive multitasking and protected memory creates a layer of protection for the operating system in which no single rogue program or any other tasks or processes can take over the available system resources, or even the entire computer. Should there be a glitch or bug in a program or utility, that specific program will crash alone. Such a crash would not affect the rest of the system, but would also release the previously used memory and resources back to the operating system. Everything else running will continue to do so without error or interruption. With scheduler, programs are not forced to pay attention to the tasks being performed or any resource demands being made by other applications. In this environment, there simply are no interaction issues. In this type of setting, programs can carry on as well or as poorly as their designers intended, without affecting the stability of the operating system or the users level of control.
Home - Table Of Contents - Contact Us
CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com
Version 1.0 - Version Date: March 29, 2005
Adapted with permission from a work created by Tcat Houser et al.
CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.