Operating System Structures Flashcards
Describe 2 approaches to operating system user interfaces
1) Command line interface. Usually implemented as a special program running when user initiate it or on start. The command line may have all the code for handling all the possible commands as part of the program or alternatively look for program in search path when user input something. The latter is approach taken by unix and is more extensible.
2) GUI interface begins appearing in the 1980s and is the most prevalent way to interact with operating systems these days.
Explain how we can view operating system as a service provider.
- Operating system is basically a provider of environment where user applications can run. It’s needed because hardware by itself cannot do this.
- As such, operating system must provide services such as user interface, a way for program to execute, to start i/o operations, etc.
Describe what system calls are
- System calls are basically the interface to services provided by the operating system, such as printing to screen, reading input, and writing output.
- System calls are typically implemented in C or assembly code, but application developers rarely access these system calls directly.
- Instead, most programming languages provide an API that hide the complexity of these system calls. In addition, this has the benefit of allowing program to be written only once as long as different os provide the same API. Implementation of system calls can differ.
- The way these API is implemented often involves first putting parameters. in registers, or main memory, or stack, before doing actual service calls. This way, cpu can actually access these parameters.
Describe various types of system calls provided by operating systems.
- Process management. Os must allow applications to make system call to end or abort the program. In addition, applications should be able to create another process, change attributes on the new process, and terminate it. Application should also be able to make system call to wait for events from process it created or wait for periods of time before control returns.
- File management. Allow applications to open, close, create, and delete files. Should also allow changing attributes on files.
- I/O management. Very similar to file management. A lot of os actually make the two the same.
- Information management. Allow applications to get information about the system like current time and date, dump memory, or amount of time spent on an instruction.
- Communication. Allow process to talk to another process either by sending messages or by sharing certain areas of memory. Sending messages are easier with no contention problems but not as fast as sharing areas of memory.
Describe what system programs are
- In computer hierarchy, we have hardware, then operating system on top of hardware, followed by system programs or system utilities
- These are programs that come with operating system that provide convenient environment for program development, management and execution
- Examples include programs to create file, edit file, get status, background service, etc.
Describe how operating systems can be structured.
- Layered approach. Separate functions into layers with the upper layer only able to use the interface provided by layer right below it. This makes it easy to debug, since we can debug from bottom up making sure each layer does the right thing. Drawback is this tends to be bad for performance and sometimes hard to figure out which functions belong in which layer.
- Microkernel approach. The kernel itself only has small amount of absolutely necessary functionalities like cpu scheduling, memory management, and message passing, everything else is created as system programs asking kernel to pass message to other system programs. This is easy to maintain and extend but bad for performance.
- Modules approach. This is pretty similar to microkernel approach. Kernel has the smallest amount of necessary things but other modules can be dynamically linked in either at run time or when os loaded.
- Hybrid. Most modern os takes a combination of these approaches.
Explain what operating system generation or sysgen is.
- Operating systems are usually written to be generic, but it must run on variety of cpu, memory available, partitions, etc.
- The process of making os specific is called sysgen and is usually done through one of the following:
1) Compile the operating system to be specific to hardware
2) Have operating system contain tables for modules specific to each hardware and link it in after getting user input on installation.
3) Have operating system contain table at runtime and load at runtime.