Monday, November 12, 2007

Guide to Operation System Part 2

Operating System Offered Services
- User Interface
GUI, Batch interface and command line interface

- Program execution
Able to load, run and terminate a program

- Input/output operations
CD/DVD drive and Display Device

- File-System manipulation
Create/read/Write/Delete files and directories
Permission management

- Communications
Local/Remote inter-process communication

- Error Detection
Able to detect error and take proper action to ensure consistent computing

- Resource allocation
Resources to be allocated among multiple users fairly
Different algorithms for different resources

- Accounting
Keep track of usage statistics e.g. CPU, Printer, HDD quota
Reconfigure system to improve computing services

- Protection and security
Security of system from outsiders
Ensure access to all system, resources is controlled
Audit trail of access

4 Major groups of basic functions of an OS
- Device Management
- Process, Thread and resource Management
- Memory Management
- File Management


Key OS Functional Requirements
- Provide resource abstraction
o Process abstraction of CPU/Memory
o Resource abstraction(anything a process can request can block, if is unavailable)
o File abstraction of secondary storage use

- Manage resource sharing
o Time/Space multiplexing
o Exclusive use of a resource (allows processes to use a resource exclusively)
o Isolation (allows a resource to save information without being modified or tampered)
o Managed sharing


Three basic mechanisms to achieve the functional requirements
- Processor modes
o Supervisor
§ It can execute all instructions including privileged instructions such as I/O instruction, memory related instructions and processor mode change instructions.
§ It can access all memory locations both System (aka. Kernel, used by OS) and User space(used by application processes)

o User
§ It can execute only non-privileged instructions.
§ It can only access User space


- Kernels
It is part of the OS and is critical to the correct operation (trusted software).
A trap instruction is used to switch from user to supervisor mode.

- Methods of calling system services
To execute a privileged instructions, a user program has to active routines in the kernel which then OS will execute them on user program’s behalf.
The two techniques:

o System Call
§ OS provides stub function which the user program can call and once called the stub function will switch processor to supervisor mode by trap instructions.
§ The user process gains ability to execute privileged instruction

o Message Passing
§ Os provides send() system call which user programs can call and waits for the result with receive() operation.
§ The System function is executed by the kernel process.(user process do not gain ability to execute privileged instruction)


Note: System calls are more efficient than message passing because message passing has cost of message formation or copying and process multiplexing and while system call just requires a trap command.

Posted by Zack at 4:06 PM