Notes for 26 January (System calls, etc.)
Table of Contents
1 Agenda and readings
- §2.1 OS services
- §2.2 User OS interface
- §2.3 System calls
- §2.4 Types of system calls
- §2.5 System programs
- §2.6 OS design and implementation
- §2.7 OS structure
- §2.8 Virtual machines
2 Notes from 26 January (snowy day)
Helped with some problems on A1. Gave slight overview of A2: screen and keyboard drivers. A2 is now available on the web site. It's long, so get started soon (after finishing A1).
2.1 Protected architectures
How can OS prevent apps from taking over hardware? CPU must have privileged mode and user mode. In user mode, instructions for hardware I/O are banned.
Machine boots in privileged mode, but OS initialization code switches it to user mode in order to execute first process.
Machine switches back whenever an interrupt calls, to run the handler in privileged mode. When handler returns, we switch back to user mode. This happens too for software interrupts, which are system calls into the OS.
2.2 Structure of OS
There are several different parts of an OS:
- the kernel
- the parts of the OS that run in privileged mode. So this includes interrupt handlers, device drivers, file systems, and the like.
- system programs
-
small utility applications that are packaged
with the operating system, but run as normal processes in
user mode. However, when they need to do something with the
hardware, they (like all applications) make a system call
into the kernel to do the job on their behalf.
Example: you can't delete a file in user mode, but there is a system call in the kernel that will do it. The
del
orrm
(delete file) program that comes with your OS is a small utility you can run and call the kernel to delete the file. - shells
- a shell is an application that provides a user interface for various system programs and functions. The two main categories are command-line shells and graphical shells. Either way, they interpret your intentions and make system calls on your behalf to get things done.