22.08.2013 Views

Factors in Operating System Design

Factors in Operating System Design

Factors in Operating System Design

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Factors</strong> <strong>in</strong> Operat<strong>in</strong>g <strong>System</strong> <strong>Design</strong><br />

◮ Performance.<br />

◮ Protection and Security.<br />

◮ Correctness.<br />

◮ Ma<strong>in</strong>ta<strong>in</strong>ability.<br />

◮ Commercial factors.<br />

◮ Standards and open systems.<br />

◮ IEEE POSIX.1 open systems standard: specifies a set of<br />

system calls and their semantics that must be supported by a<br />

compliant operat<strong>in</strong>g system. (official standard)<br />

◮ TCP/IP: Internet network protocol. Supported by most<br />

operat<strong>in</strong>g systems. (de-facto standard)


Logical Organization of an Operat<strong>in</strong>g <strong>System</strong>


The Big Picture<br />

Useful Commands<br />

ls, log<strong>in</strong>, passwd,<br />

awk, grep etc<br />

Compilers,<br />

Assembler,<br />

L<strong>in</strong>ker/Loader<br />

Shells<br />

Operat<strong>in</strong>g <strong>System</strong><br />

Hardware<br />

IDEs<br />

memory manager file manager<br />

process manager<br />

Application<br />

Programs<br />

Graphical<br />

User<br />

Interfaces<br />

device manager


Implementation strategies<br />

◮ Supervisor mode versus user mode (supported by hardware).<br />

◮ Kernel as the trusted software module.<br />

◮ Request<strong>in</strong>g system services from the operat<strong>in</strong>g system: system<br />

function call versus message-pass<strong>in</strong>g to system processes.


Privilege Levels<br />

The mode bit is used to determ<strong>in</strong>e the privilege level by the<br />

hardware. The hardware must support at least two separate modes.<br />

◮ Supervisor mode.<br />

◮ All mach<strong>in</strong>e <strong>in</strong>structions are available.<br />

◮ All memory addresses are available.<br />

◮ User mode.<br />

◮ A subset of the <strong>in</strong>structions are available. Typically I/O<br />

<strong>in</strong>structions, <strong>in</strong>structions that change the mode bit are not<br />

available. Us<strong>in</strong>g those <strong>in</strong>structions causes the process to fault<br />

and stop.<br />

◮ A subset of the memory addresses are available.


Kernels<br />

◮ The kernel is the trusted part of the operat<strong>in</strong>g system. It runs<br />

<strong>in</strong> the supervisor mode.<br />

◮ The trap mach<strong>in</strong>e <strong>in</strong>struction is used to switch from user<br />

mode to the supervisor mode. It is used to implement system<br />

calls. An alternative to trap is us<strong>in</strong>g messages to get service<br />

from the operat<strong>in</strong>g system.


Operat<strong>in</strong>g <strong>System</strong> Kernel <strong>Design</strong> Options<br />

◮ Monolithic. There is a s<strong>in</strong>gle large kernel that conta<strong>in</strong>s most<br />

of the operat<strong>in</strong>g system code. The device drivers can be<br />

separate. UNIX was conventionally a monolithic design. L<strong>in</strong>ux<br />

started as a monolithic kernel but with the <strong>in</strong>creas<strong>in</strong>g use of<br />

modules, the kernel can be made smaller and less monolithic.


Operat<strong>in</strong>g <strong>System</strong> Kernel <strong>Design</strong> Options<br />

◮ Monolithic. There is a s<strong>in</strong>gle large kernel that conta<strong>in</strong>s most<br />

of the operat<strong>in</strong>g system code. The device drivers can be<br />

separate. UNIX was conventionally a monolithic design. L<strong>in</strong>ux<br />

started as a monolithic kernel but with the <strong>in</strong>creas<strong>in</strong>g use of<br />

modules, the kernel can be made smaller and less monolithic.<br />

◮ Microkernel. The kernel is very small and only implements<br />

some fundamental th<strong>in</strong>gs like processes and schedul<strong>in</strong>g. The<br />

operat<strong>in</strong>g system then consists of several subsystems along<br />

with the kernel. MACH operat<strong>in</strong>g system is an example of a<br />

microkernel design. MS W<strong>in</strong>dows NT was based on MACH. In<br />

turn MS W<strong>in</strong>dows 2000, XP, Vista, 7 and 8 are based on the<br />

NT design although they have moved somewhat away from<br />

the microkernel approach for performance reasons.<br />

For more on the debate of monolithic versus microkernel approach,<br />

see the l<strong>in</strong>k on the class website under the Handouts section titled<br />

“Microkernel versus Monolithic kernel.”


Typical Monolithic Kernel Organization


Typical Microkernel Organization


Observ<strong>in</strong>g Operat<strong>in</strong>g <strong>System</strong> Behavior<br />

◮ For L<strong>in</strong>ux: Use ps, top or KDE <strong>System</strong> Guard ksysguard for<br />

user level tools. These tools are all based on the /proc virtual<br />

filesystem.<br />

◮ The /proc virtual filesystem under L<strong>in</strong>ux provides a w<strong>in</strong>dow<br />

<strong>in</strong>to the <strong>in</strong>ternals of the operat<strong>in</strong>g system. For example:<br />

◮ /proc/cpu<strong>in</strong>fo gives us the details of the CPU <strong>in</strong> the system.<br />

◮ The file /proc/mem<strong>in</strong>fo gives us the details of the memory <strong>in</strong><br />

the system.<br />

◮ The file /proc/stat gives statistics about the system such as<br />

how long the system has been up, number of processes that<br />

have been created s<strong>in</strong>ce the system was booted up etc.<br />

◮ The proc filesystem also has a folder for each process that is<br />

runn<strong>in</strong>g. The folder conta<strong>in</strong>s relevant <strong>in</strong>formation that the OS<br />

keeps for that process.<br />

See man proc for more details on what all <strong>in</strong>formation is<br />

available.<br />

◮ For MS W<strong>in</strong>dows: Use the Task Manager. For more detailed<br />

observations, see the website:<br />

http://www.sys<strong>in</strong>ternals.com.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!