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