121-operating-systems Flashcards
Operating system
- system software that manages and controls the computer system to make sure its efficient
- provides an interface that manages drivers, files, and users
- performs low-level tasks such as managing computer memory and resources
- allows multitasking and loads various programs into memory so they can be executed.
Function of a OS
- enable user to communicate w/ computer (provides user interface)
- resource management (scheduling)
-provides interface between all other software applications (API - application program interface), and hardware
-provides platform for software to be installed and run on
-management of interrupts, peripherals (sends output to device drivers n receives inputs from devices)
-provides utility software for system maintenace - provides security and manage users (e.g user access levels, accounts password, administrator privilege policies and etc e.g can set only user student can read, not write).
User interface
part of a computer program or system that allows a user to interact with it
Fixed and roaming profiles for a user:
fixed profile - ensures every user has the same desktop and settings
roaming profile - allows users to customize their settings which follows them when they log into different computers
Graphical user interface (GUI)-
- Uses windows, toolbars, icons used to represent resources n actions visually. Optimised for mouse and touch gesture input.
- type of GUI; WIMP (windows, icons, menus, pointers).
- Ideal for beginners/accessible by most users- easy, simple, interactive to understand/learn/ use, eliminates need to learn commands and aesthetically nice visual
- takes up more memory, less flexible, does not have same level of functionality as CLI, slower.
Command Line Interface (CLI)-
- terminal, commands line, code to give instructions/ interact.
- used by network engineers and experienced users
- Very fast + powerful, greater flexibility of use, customisable with batch scripts,
- complex to understand, less appeal as its text, difficult to learn
Kernel
- part of os that does low-level management n low-level hardware operations.
- Applications make use of kernel when they want to operate computer’s hardware
- many systems make use of the linux kernel e.g GPS, mp3 players, smartphones.
Resource Management/Multitasking:
-allows for more than one program to run at the same time
-programs held in queue. Scheduling. - Allocates small amounts of processor time to each process, cycling between them quickly
-only possibly if enough ram to hold more than one program in memory at once. Possible with VM.
File Management:
- Data is stored in files, with an extension determining which application to open the file with e.g file.py
- Over time, hard disks become fragmented with files
- Operating systems present a logical structure of files in folders (user’s benefit and doesn’t exist like that on the actual storage medium)
- and allow users to rename, delete, copy, and move files
User Management:
- Allows multiple users to log into the same computer
- Each user has different access rights to files and programs
- Operating systems retain settings for each user, such as icons and desktop backgrounds
- Client-server networks may impose fixed or roaming profiles for users and manage login requests to the network.
Memory Management:
- Freeing up memory is essential to ensure optimal performance of the computer system. When a program is closed, the allocated space is freed up for use by other programs, loaded into memory from secondary storage.
- Memory must be shared fairly between multiple programs and applications, so more than one program/document can be open at the same time
- OS determine and allocates the memory each program receives through paging, segmentation, and VM
- Different processes have different areas of memory allocated to them to prevent data from being overwritten or lost.
Buffering
- provides a temporary storage area for processes to dump outputs and store temporary data, avoiding collisions between different processes
Paging:
- Physical divisions: does not take into account program contents, memory is divided into fixed-size pages and programs are split up to fit into the given number of pages. e.g separating instructions inside a looping condition into different pages would be inefficient
- internal fragmentation (wasted unused memory allocation as fixed)
- Pages can be swapped between main memory and hard disk as needed
-page placed in special file called pagefile in HDD and swapped out for a page already in RAM, when needed
– - programs/data can be held in non contiguous memory locations using virtual addressing, making it easier to make best use of remaining storage/to avoid having i move context around to fit in new programs. it allows pages to be transferred from secondary storage (i.e. virtual memory)
as random access there is no performance drop vs sequential storage
space inside a page may be wasted as program is unlikely to take up exact number of oages, hower all pages can be used with no wasted space between them
Segmentation:
- Logical divisions: memory is divided into segments of varying (dynamic) sizes.
- Segments are representative of the structure and logical flow of the program
- Segments are allocated to complete sections of code/programs -e.g conditional statements are kept together in a segment for efficiency
- external fragmentation (free memory not contiguous enough after too many, e.g think of defrag cases , is similar))
Similarities and Differences of Paging and Segmentation
Similarities:
- Pages and segments are stored on the backing store (part of hard disk/is vm)
- Pages and segments are transferred into memory when needed.
- Both are ways of partitioning/splitting up memory.
- Both use virtual memory/backing store to swap parts of programs.
- Both allow programs larger than memory to run/insufficient memory and allow programs to be stored in memory non-contiguous.
Differences:
- Pages are fixed sized, while segments are different sizes.
- Pages are made to fit sections of memory, while segments are complete sections of programs.
- Pages are physical divisions, while segments are logical divisions.
Virtual Memory:
- Uses part of hard drive/secondary storage as temporary storage when the space in main memory is insufficient to store programs/full
- Sections of programs not currently being used are temporarily moved into VM
- frees up space in RAM so that it can be filled up with new data/programs in use
- When data in virtual memory is needed, it is moved back to RAM
- Lets you run applications larger than what RAM can support, allowing more memory to be used than there is in the system, and allows programs to be opened when RAM is full
Virtual Memory Disk Thrashing:
- when main memory is not big enough to fit all the currently active processes
- CPU has to constantly swap files to/from the backing store(hard disk/vm)
-Transferring data between virtual memory, RAM, and the CPU takes processor time
-When pages/segments of data are swapped too frequently between the hard disk and main memory, more time is spent transferring pages between main memory and the hard disk than executing instructions. - which can cause the system to hang or crash due to overuse of vm, and slows down CPU performance (disk thrashing)
- As virtual memory becomes more filled, the problem worsens.
Interrupt
- signals sent to the CPU to obtain processor time, come from control bus and are stored in the interrupt register.
- often triggered by devices indicating they need to be serviced/higher priority process/exception needs to be handled
- each interrupt triggers the execution of an Interrupt Service Routine (ISR).
- also used to handle events such as hardware errors, user input, and real-time operations.
Interrupt Register
special register where interrupts are stored in order of priority within an abstract data structure (priority queue).
Interrupt Service Routine (ISR)
- program ran when an interrupt is made.
- set of instructions that need to be fetched, decoded, and executed to carry out the operations of the interrupt.
- handles the interrupt request by interrupting the current active process.
Interrupt Handling
- processor checks interrupt register every time FDE cycle is finished
- priority of current task/executing process compared to priority of task in interrupt register to avoid delays and data loss.
- If interrupt w/ higher priority than current process then serviced, contents of registers are temporarily pushed into a stack.
- program counter contents change to point to the address for the first instruction of the interrupt
- processor responds to the interrupt by loading the appropriate ISR into RAM associated w/ the interrupt, and fetch, decode and executes it.
- when the ISR is complete, the interrupt queue is checked again for further interrupts.
- if none, processor retrieves the previous values for the original program/in the registers (popped off the stack) and carries on executing the original program/instruction where it left off.
Role of an interrupt
- allow processor to handle events that require immediate attention without wasting processing cycles by continuously polling for them.
- increase efficiency and responsiveness of the system by allowing the processor to perform other tasks until an event occurs that requires its attention.