Operating Systems Flashcards
What is an operating system?
The program that manages a computer’s resources, especially the allocation of those resources among other programs (CPU)
Purpose of operating system
Running several applications at the same time. The Operating System needs to manage the use of hardware resources amongst several applications
Definition of a process
A program in memory that is in execution.
Several processes can be in memory at the same time.
Processes can be run through several threads.
Consists of code (machine code instructions) and data in memory
Layered Architecture of an OS
Kernel + libraries + tools
Advantages of UNIX
Highly modular– includes only features you need
Highly scalable and portable– from mobile phones, desktops to supercomputer
Highly reliable– update mechanism, desktop, servers and cloud
Highly cost-effective – Linux and Android are free
Describe the five different states a process can obtain during its lifespan
running- a process currently has CPU ready- process is ready to get CPU blocked- process is waiting for some event new- created but not admitted exit- process destruction
What is a message identifier?
Named constant that identifies the purpose of the message
What are message parameters?
Specify data or the location of data used by a window procedure when processing a message
How are threads and processes scheduled?
CPU priority. They wait in a queue for their turn on the CPU. A process/thread can be in different states, i.e. waiting or running. The OS scheduler determines how long each process/thread can run before it is taken off the CPU.
How is the memory managed?
All memory areas, allocated or available, are preceded and followed by structures known as memory links. These links contain information about the area that they enclose. Using this information, the operating system can determine if the area is available or in use. If the area is currently in use, the operating system can also decide whether the area can be moved to virtual memory or moved to another location in the main memory.
How is the address translation performed?
When the system allocates a frame to any page, it translates this logical address into a physical address and creates an entry into the page table to be used throughout the execution of the program. When a process is to be executed, its corresponding pages are loaded into any available memory frames
How is the disk space for files organised?
divide files into blocks of fixed size
file is stored as blocks that are not necessarily adjacent
Explain the FAT file system
The FAT file system divides the disk space into
blocks. Pointers to each block are used in the File Allocation Table. Files are broken up into many blocks which are linked together. The entries in the File Allocation Table are the block number of the next linked block. The directory entry contains a pointer to the first file block.
Characteristics of process
Process environment- lives in a protected (memory) environment. No interference between processes. But communication between processes is possible (IPC - inter-process communication)
Resource Ownership- allocated virtual address space
(protected memory). Assigned from main memory. Control of I/O channels. Files
Code Execution- Single thread (classic process). Multi-threaded (modern process)
What are threads?
A sequence of instructions which exist within the same process. Every process has at least one thread. Threads of the same process share the same process resources, including memory and file access. Threads can run in parallel.
What is multiprocessing?
Method to run several processes and threads
What is a scheduler?
Part of the OS kernel process management that decides which processes to run next.
What is the purpose of a memory manager?
Ensures that the available memory is used effectively
What are the roles of the memory manager?
allocate memory (RAM) to processes during execution
de-allocates memory when no longer needed
re-locates memory
prevent processes from running into each other’s
memory space (security/protection)
virtualise memory
swapping process memory between RAM and disk
when memory cannot hold all process(es)
What is monoprogramming?
Only one process runs at a time
At any given moment, the operating system and one user program reside in RAM
MS-DOS
Explain the virtual memory process
Each process gets its own (virtual) linear address space but only the used elements need to be available in physical memory
combined with paging which reduces memory fragmentation
What is paging?
Process of breaking up the memory into much smaller
blocks (pages)
What is a page frame?
A page in physical memory
What is a page table?
Contains the mappings between the virtual address and physical address for each process
Every process has their own page table
Describe the address translation steps
Take the 4 higher-order bits (HOB) of the virtual address
Convert HOB into a decimal number. This is the page number
The page number is used as an index into the page table (as with arrays)
Obtain the corresponding page frame from the page table in physical memory
At position 4 of the page table, there are 3 Higher-Order Bits of the new physical address
New Physical address = 3 HOB + 12-bit offset
What is a page fault?
Occurs if a program attempts to access an unmapped page (virtual page) that is not in memory
What are the file management tasks?
To organise the file data in an efficient way Hard disk partitioning Block allocation Free space allocation File system layout organisation Security (file access control)
What are file operations?
Allow data to be stored and retrieved
Describe linked list allocation
each file is kept as a link list of disk blocks
the first word of each disk block contains a pointer to next
disk blocks are no longer consecutive
Advantages of linked list allocation
only internal fragmentation
directory entry stores the first block address
Disadvantages of linked list allocation
random access is slow
some disk space is used for pointer and not for data
Advantages of linked list with index
the entire block is available for data
single address entry for the file
Disadvantages of linked list with index
The entire table must be brought into memory
potentially high overhead (disk space for tables)