Page 1-49
A computer system is roughly composed by 4 parts:
An operating system is a program that manages the computer hardware. It also provides a basis for application programs and acts as an intermediary between user and computer hardware.
We can split this definition into two parts, according to Liuba's word on class:
Power up or reboot:
starts from a program stored in ROM(or other non-volatile memory) named Bootstrap Loader. Since it's in the ROM(hard to change), we also call it firmware. The Bootstrap Loader locate and load the OS into the main memory, then the OS starts to work. We have the pseudo-code like this:
start_point = Memory.start;
loaded = 0;
OS_length = OS.Length;
while(loaded < OS_length)
move content from disk[start_point + loaded] to Memory;
loaded++;
On working:
After executing the first process, init, the OS waits for events to occur. The occurrence of an event is signalled by an interrupt. It's from either hardware of software.
The interrupts will be handled specifically for high-speed requirement via special handler and information storage mechanism.
Both of above are volatile, small and expensive.
Non-volatile memory: read-only memory, etc. To store the bootstrap loader.
Secondary storage: magnetic disk, magnetic tape, flash storage, etc.
I/O device<-->device driver<-->device local buffer<-->OS
Multiprogramming:
Via time sharing to handle multiple jobs to utilise cpu
OS is interrupt driven. If nothing happens, it stays quietly. Events are mostly signalled by the occurrence of an interrupt of a trap.
A trap(or an exception) is a software-generated interrupt caused by an error or by a specific request from a user program that an OS service be performed.
As an error might cause problem to other programs, a robust OS must ensure that an incorrect program cannot cause other programs to behave incorrectly.
To ensure the proper execution of OS, we have different modes to execute OS code and user-defined code respectively. At least, we have 2:
When a trap or interrupt occurs, hardware switches from user mode to kernel. To simplify, when users are controlling the OS, it's user mode. When the control finishes and OS take the job, it becomes kernel mode.
To prevent a suer program from running too long.
A special, faster storage where assumed-frequently-used data is stored. It has limited size thus cache management is very important.
While OS allows multiple users and allows concurrent execution of multiple processes, then the access to data should be well regulated.
A distributed system is a collection of physically separate, possibly heterogeneous computer systems that are networked to provide the uses with access to the various resources that the system maintains.
The benefit of access to a shred resource:
Increase in:
An operating system that provides features such as file sharing across the network and that includes a communication scheme that allows different processes on different computers to exchange messages.
The embedded systems are designed to run on specific devices with limited but specific functions.