Modes of Operation
- Earlier we discussed a system call.
- System calls work because a CPU must have at least two modes of operation
- A kernel mode
- Also called supervisor, system or privileged mode
- Only mode where execution of privileged instruction is permitted.
- Examples:
- Halt
- Changing interrupt status
- Interacting with peripheral devices. (read and write)
- Some memory management instructions
- A user mode
- When the system boots, it is in kernel mode.
- It switches to user mode when it starts processes.
- When a system call occurs
- The jump to the interrupt handler switches to kernel mode
- The return from the interrupt handler switches back to user mode.
- (from Silberschatz)
- The intel CPU has four "rings", but articles I have looked at suggest that only the inner and outer are usually used.
- The Linux kernel operates with a timer.
- This sends an interrupt, which generates a system call, which invokes the kernel at regular intervals.
- This is what makes multitasking possible.
- 1.5 discusses Topics we have touched on already
- This is a:
- tell 'em what you are going to tell 'em
- Tell 'em
- Tell em what you told 'em
situation.
- We are in the first stage.
- Future chapters will address each of these.
- Read it.
- Process management
- a program is an entry on a hard drive.
- a process is a running program
- a thread is a lightweight process
- The kernel will support process:
- Created/destroyed (including data structures and table entries)
- Suspended and resumed
- Communicate with each other.
- Synchronize with each other.
- Memory Management
- A program thinks it owns all of memory.
- And that it alone changes memory
- The OS supports this idea.
- But the OS
- Givith and taketh away memory
- Writes it to disk/brings it back into memory as needed.
- Protects and keeps processes in their own memory.
- But might let memory be shared when needed.
- File Management
- The OS provides the entire idea of files/directories and other "file type" things.
- It Implements any protection/security involved with these.
- It manages the devices on which these are stored.
- It provides an abstraction for file manipulation
- Creation and deletion
- Organization
- Alteration
- Device management
- I/O system management.