As-of-yet unorganized information from lecture.
Deadlock (?)
Example: Terminating a stuck process
Suppose we have a process that is infinitely looping.
To prevent a deadlock, the computer can set a timer to interrupt the computer after some time n.
- Basically, have a counter decremented by the physical clock, and generate an interrupt if it hits 0.
- (The OS sets the counter via priviledged instruction)
Remember: One of the goals is to distribute resources equally.
Services
We want system calls for stuff like
User Interfaces
User Interface: Almost all OSes have a user interface (UI)
Program Execution: System must be able to load a program into memory, run that program, and end (normally or abnormally).
I/O: A running program may require I/O, which may involve a file or an I/O device.
II.
File System Manipulation: Read/write, create/delete, ls, permissions.
Communication: Exchange info on same computer or between computers.
- Two major ways: Shared memory, and message passing (packets).
Error Detection: OS should take appropriate action to ensure corret and consistent computing
- Memory hardware, I/O devices, user programs.
- Debugging can greatly enhance user and programmer abilities to use the system.
Resource Allocation
Functions for resource sharing.
Resource Sharing: When multiple users/jobs run concurrently.
- e.g., sharing CPU, main memory, storage, I/O devices
Accounting: Keep track of which users use how much and what kinds of resources.
Protection and Security:
- Protection: Access to resources controlled.
- Security: Requires user authentication, extends to external I/O as well.
CLI
Command Interpreter: Allows direct command entry.
- Outmost layer of the OS.
- Flavors: Shells
- Sometimes implemented in kernel.
Example: Built-in and not built-in commands
- Some commands may be implemented in the OS, translating straight into system calls.
write(...)
# implementation here
read(...)
# implementation here
- (More popularly), we modularize the definition, and the OS only provides an interface.
write(...)
# interface
read(...)
# interface
GUI
You know what a GUI is.
- A metaphor for stuff, icons, mouse, windows, et cetera.
System Call Implementation
TODO Add this to previous
System calls can be:
- defined in the main body of the kernel, or
- loaded in main memory
Typically a number is associated with each system call.
- The indexing in maintained by the system-call interface.
System-Call Interface:
- Invokes intended system call in kernel and returns status and any return values.
- Caller know nothing about implementation. Details are hidden.
- Caller only needs to obey API.