1, 2 Flashcards
What is an operating system?
A main program that ALWAYS runs on the processor from system startup, and manages the execution of other programs
What are the steps involved in executing a program?
- When system starts, execute operating system.
- Load additional programs into memory.
- Request execution of program using a system call.
- Operating system starts execution of program.
What is a system call?
A mechanism that allows user-level programs to request services or resources from the operating system’s kernel, such as file operations, memory management, or process control.
What are the three elements of a computer system?
- Users (humans, machines)
- Software (application programs, operating system, system programs)
- Hardware - CPU, memory, battery, input/output devices
What are application programs?
Software designed to perform specific tasks or functions for end-users on a computer system, typically operating on top of the system software in a device
- e.g., word processing, web browsing, data analysis
What are system programs?
Software that manage and support a computer’s core functions, facilitating communication between hardware and application programs
What is the CPU?
The central processing unit, the primary component of a computer that performs calculations, executes instructions, and manages data processing tasks to run programs and operations
What is a device controller?
A hardware component managing the communication between the CPU and external devices (such as storage drives, printers)
- translates data and control signals between them
What is an interrupt?
A signal sent to the CPU by hardware or software to temporarily halt its current operations and redirect its attention to a higher-priority task or event
What is a device controller buffer?
A temporary storage area that holds data being transferred between a peripheral device and the system’s memory, helping to manage data flow and prevent bottlenecks during communication
Describe as an example the process of a computer accessing data on a hard drive. Why is this example inefficient? How can some of these issues be fixed?
- CPU tells device controller what data it wants to read (writing command + address in device controller registers)
- Device controller accesses the hard drive.
- Hard drive recovers data on disk and writes it in the device controller buffer.
- Device controller tells the CPU that the data is ready using an interrupt.
- CPU reads data in the device controller and copies it in memory.
CPU wastes time waiting for I/O operation to complete. CPU performs many copy operations. CPU must treat many interrupts.
By using direct memory access DMA
What is Direct Memory Access (DMA)? Provide an example of accessing data on a hard drive using a DMA.
A method that allows peripheral devices to transfer data directly and from the system’s memory without involving the CPU
- CPU tells DMA what block of data it wants to read (command + start address + size of block it wants in DMA registers)
- DMA configures the I/O device controller for every data that must be read.
- Device controller accesses the hard drive.
- Hard drive recovers data and writes it in the device controller buffer.
- DMA reads data in device controller and copies it in memory.
- Once all the data is transferred into memory, DMA tells CPU the I/O transfer is completed using an interrupt.
How does the CPU interface with the device to coordinate the transfer for DMA?
CPU initiates a DMA operation by writing values into special registers that can be independently accessed by the device.
Device initiates corresponding operation once it receives the command from the CPU.
CPU Is allowed to execute other programs while the DMA controller is transferring data. Does this process interfere with the execution of user programs? If so, how?
Both device and CPU can be accessing memory simultaneously. A CPU might therefore have to compete with the device to access the memory, lowering its speed.
What are the advantages of DMA? What are some issues regarding to DMA?
Less operations executed by CPU. Less interrupts to treat. CPU can execute other useful code in parallel.
Deciding what to execute while waiting for I/O operation. Providing code to configure hardware devices, treat interrupts. Ensuring program state remains consistent through switches.
Describe three general methods for passing parameters to the operating systems.
- Passing parameters in registers.
- Registers pass starting addresses of blocks of parameters.
- Parameters can be placed, or pushed, onto the stack by the program, and popped off the stack by the OS.
Provide an example of system components that are difficult to layer?
The virtual memory subsystem and the storage subsystem are typically tightly coupled and requires careful design in a layered system due to the following interactions. Many systems allow files to be mapped into the virtual memory space of an executing process. On the other hand, the virtual memory subsystem typically uses the storage system to provide the backing store for pages that do not currently reside in memory. Also, updates to the file system are sometimes buffered in physical memory before it is flushed to disk, thereby requiring careful coordination of the usage of memory between the virtual memory subsystem and the file system.
What are some of the specific functionalities of the OS as an intermediary between users/applications and computer hardware?
Providing a level of abstraction that hides the details of hardware architecture from applications.
Manages sharing of HW resources among applications and users.
Optimises performance through resource management.
What would application developers have to know without operating systems? What effects would this have?
Hardware platform details to be able to write applications.
Managing memory and address space.
Manage I/O operations.
Manage communications.
Manage file system.
Time consuming, error prone application development. Low portability, as code cannot be easily used on other HW platforms. Hard to use third-party code and libraries.
What is a driver?
A software development that allows the operating system to communicate with and control hardware devicesm providing a standardised interface for device functionality
What are the 8 main responsibilities of an operating system?
- Process Management:
- creating and deleting, scheduling, suspending, resuming, synchronising, inter-process communication - Memory Management:
- allocating, deallocating memory space; efficient utilisation of memory; kepping track of current memory use and by whom - I/O Management:
- buffer-caching system, general device-driver interface, drivers for specific HW devices - File Management:
- mainpulating files, directories; maping files onto secondary storage-disks; free space management and storage allocation; disk scheduling - Protection:
- ensuring that concurrent processes do not interfere with one another - Error Detection:
- debugging facilities - Security:
- against other processes, outsiders - Accounting:
- using timers, CPU Cycles, main memory usage, I/O device usage
What is an interrupt service routine?
A specialised function or routine in software that is executed in response to an interrupt, handling the interrupt cause and ensuring the CPU can resume its normal operations afterward
What is an interrupt vector table?
A data structure that holds the addresses of interrupt service routines (ISRs), allowing the CPU to quickly locate and execute the appropriate ISR when an interrupt occurs
Describe an example of a HW device instructing the OS to carry out an operation.
- Interrupt generated to notify the CPU of something.
- OS saves current execution context.
- OS checks what caused interrupt.
- OS retrieves the address of corresponding interrupt service routine from interrupt vector table.
- OS executes the interrupt service routine.
- OS resumes execution context.
What are traps/exceptions? For what purposes can they be used?
Software-generated interrupts caused by either a software error or by calling a specific assembly function
Calling operating system routines or catching errors
What is the trap handler?
A routine in the operating system that handles exceptional conditions or events that interrupt the normal execution of a program
Describe an example of an application generating a trap and the consequent operations.
1.Application generates trap
2. CPU jumps at predefined address in memory corresponding to the trap handler
3. OS saves current execution context
4. OS checks why the trap was generated
5. OS executes the requested service
6. OS resumes the execution context
What is the OS Dual-Mode Operation? What is the user-mode? How about the kernel mode? Which operations are executed in which mode?
What is the advantge of this Dual-Mode?
A system architecture that allows the CPU to operate in two modes, user and kernel.
Where application run with limited access to system resources.
Where the operating system has full control over hardware and system operations.
Most instructions executed in user mode, but some privileged instructions are only executable in kernel mode, such as accessing memory locations reserved for the OS.
Allows the OS to protect itself and other syste components