Lecture 2 Flashcards
Steps in the transition from user to kernel mode
- User code issues a system call
- Mode is changed to kernel mode
- OS checks that everything is in order and legal
- OS executes system call
- Mode is set back to user mode
True or false: a single system call may contain multiple privileged instructions
True
System calls enable users to…
…Access OS services
System calls are typically written…
…in a high-level programming language (like C/C++)
Each system call has a…
…System call number
System calls are accessed via…
…an API (Application Program Interface)
What does an API do
- Hides the details of implementation of system calls
- Offers portability across the OS
Common APIs
- POSIX (UNIX, Linux, Mac OS X)
- Java API (Java Virtual Machine)
- Win32 (Windows)
Programming languages can be seen as APIs when they have…
…file I/O operations
What does the command $ strace -c [command] do?
Displays summary info on system calls invoked during
the execution of the command
Numerous system calls are typically invoked for…
…even simple tasks
Types of system calls
- Process Control
- File Manipulation
- Device Manipulation
- Information Maintenance
- Communication
- Protection
Steps in using a timer for protection
- Before giving user control of a program, OS sets a
timer (usually in the millisecond range) - After period expires, timer chip issues a system
interrupt, giving the OS control again - OS decides whether to kill the process or let it
continue
Why is a user holding resources to long a problem?
Malicious user might be exploiting something, or the program may have just bugged out
Types of OS structure
- Monolithic (everything the OS does goes in the
kernel) - Layered (Hardware is bottom layer, user interface is
top layer, with multiple layers in between) - Microkernel (Kernel only does what it absolutely has to)
- Modular
- Hybrid
Pros and Cons of Monolithic OS
- Pro: efficient in terms of space and speed
- Con: Difficult to implement + maintain (too much in
one layer)
Pros and Cons of Layered OS
- Pro: Easier to develop, debug, and update
- Con: Less efficient, and it’s hard to decide what goes
on which layer
In a microkernel structure, modules communicate using…
…Message passing through kernel
Pros and Cons of Microkernel OS
- Pro: Easier to extend microkernel/port to new devices,
more reliable and secure - Con: More performance overhead
In a modular structure, core components go in the…
…Kernel module
In a modular OS, how are new modules loaded?
They are linked to the kernel as needed
Modules talk to each other using…
…well-defined interfaces
Modular Structure Advantages
- Easy to maintain, update, and debug
- Similar to layers but more flexible
- Similar to microkernel but more efficient
OS must be available to ____ to start it
Hardware
On powering up, the instruction register is loaded with…
…a predefined memory location (usually the location of the Bootstrap loader in ROM)
Bootstrap loader routine:
- Performs diagnostic tests
- Move boot block from fixed location to memory
- Boot block loads the rest of the loader from the disk
- Boostrap loader loads kernel