Operating systems
What is the size of the page table on a 32 bit machine with 4kb page size
(number of pages * size of each page table entry) = 2^20 * 32 bits = 4MB
What are the two things to think about when choosing a Round Robin Quantum
- Should be much larger than context switch cost - But still provide decent response time (typically between 10 -200ms)
HERE Number of table entries on a 32 bit machine with 4 KB page size
2^32 / 2^12 = 2^20
What are the number of page table entries if you have 4KB (2^12) page size on a 32 bit machine
2^32/2^12 = 2^20
What is the size of each page table entry on a 32 bit machine with 4kb page size
32 bits (20 bits for page number + other bits (eg protection bits))
Typical page size
4KB
What is a hole in memory
A block of available memory Holes of various sizes are scattered throughout memory
What is a page
A block of logical memory that is the same size as a frame (a block of physical memory)
Three disadvantages of user level threads
A blocking system call stops all threads in the process During a page fault the OS blocks the whole process - wasteful for threads that might be runnable Difficult to implement preemptive scheduling and generally difficult to program
What are the two components of a semaphore data structure?
A counter (non-negative) integer A queue of processes currently waiting for that semaphore - queue is typically first in first out (FIFO)
What is a frame
A fixed sized block of physical memory
What is a monitor
A higher-level synchronisation primitive - a language construct. Makes programming easier and less error prone than using semaphores - however not supported by all languages
What are UNIX signals
A limited form of inter-process communication (IPC). A signal is an asynchronous notification sent to a process or to a specific thread within the same process in order to notify it of an event that has occured
What is a pipe
A method of connecting the standard output of one process to the standard input of another. One-Way communication, two types: names and unnamed
Device controller
A piece of hardware that controls the device and implements an interface between the device and rest of the system
What is a device driver
A piece of software that is part of the OS and is responsible for interacting with a particular device
Describe two general parts that you can find in an operating system that has been designed to be highly portable
A portable operating system can be split into a (1) platform specific section and (2) a platform independent part The platform-specific part contains any OS code that is dependent on the given processing architecture and platform. All other OS functionality is implemented as part of the platform independent part that uses the API exposed by the platform-specific part to invoke any low-level hardware functionality. When porting the OS, only the platform-specific part has to be reimplemented for a new platform. The rest can just be recompiled for the new architecture (This type of division is found in the Linux kernel)
What is mounting
A process by which the operating system makes files and directories on a storage device available for users to access via the computer's file system
Why is the separation into a user mode and a kernel mode considered good operating system design?
A process executing in user-mode can cause less damage because it is restricted from executing privileged operations. By splitting an OS design into user-mode and kernel-mode components, the OS designer makes it explicit which parts of the OS require raised privilege and full access to the hardware. This is an example of the principle of least privilege that should guide the design of any secure systems
What is a critical section/region
A section of code in which processes access a shared resource
What is a critical section
A section of code in which processes access a shared resource (It is critical if it reads a memory location which is shared with another process) (Updates a shared memory location with a value which depends on what it read)
Describe a communication deadlock and how to solve it
A sends message to B and blocks waiting on B's reply. If B did not get A's message, then A is blocked and B is blocked waiting on message = deadlock Solution - communication protocol based timeouts
What is an atomic operation
A sequence of one or more statements that is/appears to be indivisible
What is a deadlock
A set of processes is deadlocked if each process is waiting for an event that only another process can cause
What is the condition for a deadlock
A set of processes is deadlocked if each process is waiting for an event that only the other process can cause
What is required at the entry and exit of the critical section
A synchronisation mechanism
Why is having Address Space Identifiers (ASIDs) as part of the Translation Lookaside Buffer (TLB) useful?
ASIDs allow the TLB to protect certain entries by having entries from several processes, otherwise on a context switch the entire TLB must be flushed
Physical address space
Address seen by the memory unit Refers to physical system memory
Give 2 advantages and 2 disadvantages of monolithic kernels
Advantages: - Efficient calls within kernel - Easier to write kernel components due to share memory Disadvantages - Complex design with lots of interactions - No protection between kernel components
Microkernel three advantages and one disadvantage
Advantages: Kernel itself not complex = less error prone Servers have clean interfaces Servers can crash and restart without bringing kernel down Disadvantages - High overhead of IPC within kernel
What is internal fragmentation
Allocated memory is larger than requested memory, but size difference is internal to partition
What is internal fragmentation
Allocated memory is larger than requested memory. Some portion of memory is left unused as it can not be used by another process.
Describe the Copy-on-Write virtual memory trick
Allows parent and child processes to initially share same page in memory - if either process modifies shared page, then copy page This gives you efficient process creation - only modified pages are copied
What does Multiprogramming allow
Allows the processor to be used by other programs while one program is performing I/O
What is an associative memory? How does it work and how is it implemented?
An associative memory is one that is accessed by content rather than by address. Often an 'entry' in associative memory will have two parts, a tag and a value. To access the associative memory one supplies a tag (Page number from virtual address). If that tag matches the tag of an entry in the associative memory, that entry is returned giving the frame number. In a hardware implementation (e.g. a TLB), the tags of all entries are checked in parallel
What is another name for the TLB
Associative memory
Describe lottery scheduling
At each scheduling decision, one ticket is chosen at random and the job holding that ticket wins (A job can hold more than one ticket = gives it higher chance of winning)
How can deadlocks be prevented with reference to four conditions
Attack on of the four deadlock conditions: Mutual exclusion Hold and wait No preemption Circular wait
In what environment are non preemptive algorithms acceptable
Batch systems
Give two advantages of user level threads
Better performance - Thread creation and termination are fast - Thread switching is fast - Thread synchronisation is fast - None of the aforementioned activities involve the kernel Application specific run-times - each application can have its own scheduling algorithm
Two types of device
Block devices, Character devises
What is the difference between block and character devices
Blocks stores information in fixed size blocks and transfers are in units of entire blocks Character Devices, delivers or accepts stream of characters, without regard to block structure. Not addressable, does not have any seek operation
How does disabling interrupts work?
By disabling interrupts the CPU will be unable to switch processes. This guarantees that the process can use the shared variable without another process accessing it CLI() (clear interrupt flag) STI() (set interrupt flag)
How can the circular wait condition be prevented?
By ordering the resources we can prevent the circular wait condition. For example with the Dinning Philosphers problem if we order the resources and request them in a specific order where processes request lower numbered resource first and only request higher numbered resource if lower resource is already acquired, then the circular wait condition is prevented
Difference between CPU-bound and I/O bound processes
CPU-bound processes spend most of their time using the CPU I/O bound processes spend most of their time waiting for I/O. Tend to only us CPU briefly before issuing another I/O request
Name four space allocation techniques
Contiguous file allocation Block chaining File allocation table Index blocks
What does fork do?
Creates a copy of the current running process
Disks can be broken down into
Cylinders, Tracks, Sectors
What does a cycle in a directed resource allocation graph mean?
Deadlock
What is defragmenting a file system?
Defragmenting a file system means that blocks belonging to the same file are move around to ensure that they occupy consecutive disk blocks. This improves the read/write performance because it avoids unnecessary disk seeks In general any file systems can become fragmented to a certain extent. However, some file systems may suffer less from fragmentation when they ensure that blocks for files are allowed in nearby or consecutive locations on the disk. For example, block allocations may be done according to zones
What is the algorithm for detection and recovery
Do a depth first search from each node in the graph and check for cycles
What is low-level format
Done to create the disk sector layout of the hard drive. Usually done by the manufacturer
How does the CPU communicate with Devices
Each hardware controller has a few registers used for communication with the CPU - OS can write to these registers to command the device, to deliver data, accept data, switch on/off, perform some action OS can read from the device registers to learn about the state of the device - whether it is ready to accept commands
What is the basic idea behind virtual memory
Each program has its own address space which is broken up into chunks called pages
Give five goals of scheduling algorithms
Ensure fairness (comparable processes should get comparable services) Avoid indefinite postponement Enforce Policy Maximise resource utilisation Minimise Overhead (from context switches, scheduling decisions)
What is thrashing
Excessive paging activity causing low processor utilisation - Program repeatedly requests pages from secondary storage
What is external fragmentation
External fragmentation arises when free memory is separated into small blocks and is interspersed by allocated memory.
If Quantum tends towards infinity in round robin scheduling, what do you get?
FCFS behaviour
What sort of job is favoured by General Purpose Scheduling
Favour short I/O bound jobs (however not always clear cut - processes have periods when they are I/O bound and periods when they are CPU bound)
Describe in memory terms how to run a program of size n pages
Find n free frames and load program into physical memory ( can be non continuous between frames) Set up page table to translate from logical into physical addresses (advantages - avoids external fragmentation and avoids problems of variable-sized memory chunks)
(3) dynamic memory allocation algorithms
First fit Best fit - produces smallest leftover space Worst fit - produces largest leftover space (Best fit and Worst fit have to search all array unless already ordered)
Dynamic memory allocation alogrithms (3)
First-fit, Best-fit, Worst-fit
What are the two types of process and what is the distinction
Foreground process - interacts with users Background process - (eg syslog) (daemons)
How do we manage a storage device's free space?
Free list - a linked list of blocks containing locations of free blocks
What is logical address space
Generated by the CPU (virtual and does not exists physically) Address space seen by the process
What is a memory management unit
Hardware device for mapping logical to physical addresses
SECOND ROUND: The Kernel executes in privileged mode, what does this mean in practical terms?
Has access to all hardware
If there are no empty pages on a SSD what is the process of writing to a page?
Have to find a page to erase and then erase it before you start writing to it
Three types of page tabling
Hierarchical, Hashed, Inverted
What are the highest priority jobs in multilevel feedback queues
I/O bound with shortest quantum
What is the advantage of multiprogramming
I/O is slow compared to computation time and so programs spend a lot of time waiting for I/O. Multiprogramming allows the processor to be used by other programs while one program is performing I/O. It improves the utilisation of expensive resources Multiprogramming also allows the user to perform different activities at the same time - a compilation of one program while editing or another
Give two examples in which processes switch from user to kernel mode
If a process is running a user program in user mode and needs a system service, such as reading data from a file, it has to execute a system call to transfer control to the operating system. The operating system then figures out what the calling process wants by inspecting the parameters. A system call is then carried out and after the control is returned to the instruction following the system call. Anything related to Process Management, IO hardware manage, memory management requires a process to execute in Kernel mode
What problem does Scheduling deal with
If multiple processes are in the read to run state then which one should be run. Allocates processes to processors
What does scheduling deal with
If multiple processes are ready, which one should be run
When is the bankers algorithm in a safe state
If there exists a sequence of allocations that guarantees that all customers can be satisfied (Request granted only if it leads to a safe state)
Four ways of dealing with deadlocks
Ignore it Detection and recovery Dynamic avoidance Prevention
What is 'aging' in the context of multilevel feedback queues
Increasing a job's priority as it waits
How can a OS construct a bitmap from scratch
Initialise the block bitmap Start at the root of the file system (the '/' directory), and mark every block used by every file found through a recursive descent through the file system. When finished should update the stored free block bitmap
SCAN Scheduling (Elevator Algorithm)
Is the most common form of scheduling Long delays for requests at extreme locations Process requests that result in the shortest seek time in the preferred direction. The direction is only changed after reaching the outmost/innermost cylinder (or no further requests in preferred direction) Has almost as good throughput as SSTF and doesn't starve any process
Describe priority scheduling
Jobs are run based on their priority - Always run the job with the highest priority. Priorities can be externally defined or based on same process-specific metrics Priorities can be static or dynamic processes are run to completion§
Kernel threads advantages (2)
Kernel can simultaneously schedule multiple threads from the saem process on multiple processors Blocking system calls/page faults can be easily accommodated (if one thread calls a blocking system call or causes a page fault, the kernel can schedule another runnable thread from the same process) Kernel routines can be multi-threaded
What are the LFU and MFU algorithms
Least frequently used Most frequently used When thinking about page replacements
User level threads are scheduled by the
Library (at the user level the kernel cannot see them)
An example of a monolithic kernel
Linux
Kernel-level threads
Managed by the kernel (can also have hybrid user level threads and kernel level threads)
What does the memory management unit do?
Maps logical addresses to physical addresses
What are real time systems specific goals
Meeting predictable deadlines - avoid losing data Predictability - avoid quality degradation in multimedia systems For example: you have a device that regularly collects data - missing a deadline means missing data
Give two issues with threads that come from share address space
Memory corruption - one thread can overwrite another thread's stack Concurrency bugs - managing concurrent access to shared data
What allows the processor to used by other programs while one is performing I/O
Multiprogramming - improves the utilisation of expensive resources
The four necessary conditions for a deadlock to hold
Mutual Exclusion Hold and Wait No Preemption Circular Wait
Three critical section requirements
Mutual Exclusion - No two processes may be simultaneously inside a critical section. Processes must request permission to enter critical sections Progress - No process outside the critical section may prevent other processes from entering the critical section Bounded Waiting - No process wanting to access its critical section can be delayed forever
The four conditions that must hold for you to have a deadlock
Mutual exclusion Hold and wait No preemption Circular wait
What are SSDs built on
NAND flash memory
What is NAND memory
NAND flash memory is a type of nonvolatile storage technology that does not require power to retain data
What is a File
Named collection of data of arbitrary size
Give the five process states
New (the process is being created) Ready (runnable and waiting for processor) Running (executing on processor) Waiting/Blocked - waiting for an event Terminated (process being deleted)
What are the five states of the five state process model
New, Ready, Running, Waiting/Blocked, Terminated
If a single threaded process is blocked on the keyboard can it fork?
No (but a multi threaded process with one thread stuck on keyboard can fork)
Can mutual exclusion be provides by general semaphores
No - general semaphores are used for counting. Binary semaphores are used for mutual exclusion (so are locks)
Is multilevel feedback scheduling algorithm suitable for real time and multimedia apps?
No because for priorities to be properly reflected in the decisions, the system needs to be up and running for a while, so not suited for real time and multimedia apps
Can 2 User level threads synchronise using a kernel semaphore
No because the kernel can only see kenal level threads
Can general semaphores provide mutual exclusion
No only locks and binary semaphores
Describe the disk seek FCFS algorithm
No ordering of requests = random seek pattern - Ok for lightly loaded disks - performs best when the average queue length is close to one - Poor performance for heavy loads - Fair scheduling
Is it possible to go from waiting to running?
No, in order to run, a process that is waiting has to be added to the ready queue before it can be run
Five types of process termination
Normal completion (completes execution of body) System call - exit() in UNIX Abnormal exit - process has run into an error or an unhandled exception Aborted - process stops because another process has overruled it execution (e.g. killed from terminal) never - many real-time processes run in an endless loop and never terminate unless error occurs
What is a race condition
Occurs when multiple threads or processes read and write shared data and the final result depends on the relative timing of their execution (i.e. on the exact process or thread interleaving)
What is a race condition
Occurs when multiple threads read and write shared data and the final result depends on the relative timing of their execution on the exact process or thread interleaving
Where is space space located?
On hard disk - it is a dedicated area of disk where memory data can be swapped out into and later swapped back into memory as necessary
What is a bitmap
One bit in memory for each disk block - can quickly determine available contiguous blocks are certain locations on secondary storage (disadvantage - may need to search entire bitmap to find free block, resulting in execution overhead)
What is a non preemptive system
One in which a process is run until it blocks or voluntarily releases the CPU
Multilevel Feedback Queues describe
One queue for each priority level Run job on highest non-empty priority queue
Describe Shortest seek time first (disk seek algorithm)
Order requests according to shortest seek distance from current head position - Has good throughput - Discriminates against innermost/outermost tracks - Unpredictable and unfair performance
How can the circular wait condition be prevented
Ordering the resources
What happens if the scheduling Quantum allocated is too short
Overhead is too high as there are too many context switches. (Ideally you want a Quantum that is the average length of a process time but this is impossible to know)
What are PThreads
POSIX (Portable Operating System Interface) Threads - provides APIs for creating and managing threads
An address generated by the CPU can be divided into two parts:
Page number (used as an index into the page table) & Page offset (Defines physical memory address sent to the memory unit, combined with base address)
What do you do if the page table gets too large
Page the page table
What are the two registers associated with page table implementation
Page-table base register Page-table length register
How is virtual memory implemented
Paging and segmentation
What is it called if a process is stopped after a given period of time (Quantum)
Preempted
What is Preemptive Scheduling
Preemptive Scheduling is a CPU scheduling technique that works by dividing time slots of CPU to a given process.
Describe Shortest Remaining Time
Preemptive version of shortest job first - run times have to be known in advance Choose process whose remaining time is shortest - when new process arrives with execution time less than the remaining time for the running process, run it (Although do not want to do this if the overhead is greater than the difference in remaining run-times for the two jobs)
Multi level feedback queue general notes
Priorities make no guarantees - what does priority 15 mean? (different level queues can implement different scheduling algorithms) Does not react quickly to changes - a problem for real-time systems (multimedia apps) Cheating is a concern - add meaningless I/O to boost priority Cannot donate priority Worry about the starvation of lower-priority jobs
At a high level the three types of data stored in a PCB
Process management Memory management File management
Round-Robin Scheduling
Process runs until it blocks or time quantum exceeded
In the multilevel feedback scheduling algorithm can processes move between different queues?
Processes are allowed to move between different queues based on how their priorities change over time
What is a livelock
Processes/threads are not blocked, but they or the system as a whole does not make progress
What does PSW stand for?
Programme status word - contains the information required for proper program execution
The I/O Techniques
Programmed I/O, interrupt driven I/O, Direct Memory Access
What is the idea of locality of reference
Programs tend to request same pages in space and time
Describe four advantages of Processes
Provides the illusion of concurrency Provides isolation (each process has its own address space) Simplicity of programming (can write programs independently (emacs doesn't worry about chrome) Allows better utilisation of machine resources (different processes require different resources at different times)
What information needs to be saved and restored during a context switch between two threads from different processes
Registers, stack pointer, PC, also need to load the pointer to the top level page table of the new process. No need to save this for the old process as it does not change and is already in the PCB
What information needs to be saved and restored during a context switch between two threads in the same process
Registers, stack pointer, and PC need to be saved and restored
What does the Banker's Algorithm ensure
Request granted only if it leads to a safe state
Describe the two partitions that main memory is usually split into
Resident operating system (Kernel): usually held in low memory with interrupt vector User processes: held in high memory
What is a key problem with Shorest Job First and Shortest Remaining Time
Run times are usually not available in advance - Could have user supplied estimates but then need to counteract cheating to get higher priority
Total disk access time can be broken down into
Seek + latency + transfer
C-SCAN
Services requests in one direction only. Maintains two queues, but when the current one becomes empty it seeks to serve the request closest to the farthest edge of the disk and resumes seeking in the same direction from there. It is slightly slower than SCAN but does not discriminate in favour of blocks in the middle of the disk. - When head reaches innermost request, jump to outermost request - Lower variance of requests on extreme tracks - May delay requests indefinitely
the four main characteristics of an operating system
Sharing (data, programs, hardware, resource allocation) Concurrency (support multiple parallel activities, switch activities, safe concurrency) Non-determinism (interrupts, input errors, network packet loss) Storing Data (persistent storage)
Describe how compaction reduces external fragmentation
Shuffle memory contents to place all free memory together in one large block
What is spooling
Spooling is the allocation of all interaction with a given device to a single process; other processes that want access to the device must go through the spool process.
Busy waiting
Strict alternation solution requires continuously testing the value of a variable called - busy waiting Wastes CPU time Should only be used when wait time is expected to be short
describe the difference between swapping and paging in the context of memory management
Swapping means moving entire address spaces between the disk and the memory. Paging means moving individual pages, so that part of an address space may be on disk while the other part is in main memory
What is dynamic avoidance of deadlocks and what is an algorithm for it?
System grants resources when it knows that it is safe to do so Banker's algorithm - Dijkstra
Three ways in which processes are created
System initialisation User request System call by a running process
Describe N-Step SCAN
Take a snapshot and service all things that exist in that snapshot. Wait until after finished serving all these requests until you move onto next batch. Uses SCAN Requests arriving during sweep serviced during return sweep
Why is process switching more computationally expensive than thread switching?
The amount of data associated with a process is far higher
What is the ideal quantum for Round robin
The average CPU time between I/O
What does the page table store
The base address of pages in physical memory
Give the biggest advantage and disadvantage of implementing threads in user space
The biggest advantage is efficiency - No traps to the kernel are needed to switch threads. The ability of having their own scheduler can also be an important advantage for certain applications. The biggest disadvantage is that if one thread blocks, the entire process blocks
What does mounting allow
The combination of multiple file systems into one namespace
What happens when a signal is received by a process
The default action for most signals is to terminate the process, unless the process has installed a handler for that signal (note SIGKILL and SIGSTOP cannot be ignored/handled)
What problem does the Translation Look-aside buffer look to solve
The fact that every data/instruction access requires two memory accesses - one for page table and one for data instruction The solution is a special fast-lookup hardware cache as associative memory
What is the difference between user level threads and kernel level threads
The kernel is not aware of user level threads - each process manages its own threads (maintains a thread table and does thread scheduling)
What is the flash translation layer
The layer between the OS and the NAND memory
Describe the ideas behind policy versus mechanism
The main process may have an excellent idea of which of its children are the most important and which the least Want to have a way that user processes can input into scheduling decisions Separate the scheduling mechanism from the scheduling policy The scheduling algorithm is parameterized in some way but the parameters can be filled in by user processes
What is the trade off between lock overhead and contention
The more contention the lower overhead (more contention = less parallelism)
Lottery scheduling notes
The number of lottery tickets is meaningful - unlike priorities, job holding %p of the tickets gets p% of the resources Highly responsive - New job given p% of tickets has p% change to get the resource at the next scheduling decision No starvation Jobs can exchange tickets that allow for priority donation. Allows cooperating jobs to achieve certain goals Downside: Unpredictable response times - a processes could theoretically get continuously unlucky
What is the Kernel of an operating system
The part of the operating system that is always in memory and implements the most commonly executed functions of the OS. The OS Kernel executes in kernel or privileged mode and therefore has complete access to all hardware (in contrast to user mode)
What are threads
The smallest unit of execution that can be allocated processor time
What is a thread
The smallest unit of execution that can be allocated processor time
Four reasons for context switches
The time slice of process A has expired (periodic) Process A is blocked waiting for I/O or a resource Process A has run to completion External event results in a higher priority process B to be run
Consider an Operating System that uses Inodes the provides two system calls - COPY (which copies file) and RENAME (which renames file). Briefly discuss the difference between using these system calls to change the name of a file
There is some performance impact as COPY creates a new copy while rename only the indone entry needs to be changed. Some space impact as well since the old file with COPY is still available With COPY the file attributes will change (creation time and date etc.) while with RENAME this would not be the case
Describe inodes
They store information about files and directories. They contain a list of pointers to the file data blocks and also store pointer to more index blocks which are used as necessary
Kernel threads disadvantages (2)
Thread creation, termination and switching is more expensive (but cheap compared to the same operations with processes) No application specific scheduler
Why is thread synchronisation required
Threads in a process share its global variables Threads in a process shares its address space Threads in a process share its files
Seek time
Time taken for the necessary track to appear under the read/write head of the hard drive
In First Come First Served where are runnable processes added?
To the end of the ready queue (No indefinite postponement - all processes are eventually scheduled, very easy to implement)
Describe a situation when block size is too large or too small
Too large = wastes space for small files, also more memory needed for buffer space
What is the name of the memory cache that stores recent transactions of virtual memory to physical addresses for faster retrieval
Translation lookaside Buffer (TLB)
The time interval from a process being submitted to the time of its completion is called
Turnaround time
What is Fair Share Scheduling
Users are assigned some fraction of the CPU - scheduler takes into account who owns a process before scheduling it
What is Belady's Anomaly
Using the FIFO algorithm more frames actually results in more page faults
Block Linkage (Chaining) disadvantages
Wastes pointer space in each block
What is the idea of copy on write in SSDs
When a OS updates a page, write a new page rather than overwrite on and update the mapping (this is because erasing is so slow) Older pages can be erased later
What problem does virtual memory try to solve
When a process is too large to fit into main memory
When is shortest job first provably optimal?
When all jobs are available simultaneously (Non preemptive scheduling with run-times known in advance)
When are signals generated
When an exception occurs
When does page replacement occur
When there are no free frames (replacement algorithm is looking for lowest page fault rate)
What is a process control block (or process descriptor =)
Where data on non completed processes is stored. Contains all information needed to safely restart the programme should be stored
How can mutexes be created with semaphores
With binary semaphores
Does each thread have its own stack, registers, program counters and state?
Yes
Can a thread access the memory of the process to which it belongs
Yes Access to the memory and resources of its process - shared with other threads belonging to that process
Can a kernel level thread running in a critical section be context switched?
Yes and no. Kernel-level threads which run with interrupts disabled would not get context-swichted, but can be otherwise
Can a user level thread running in a critical section be context switched?
Yes since they use locks/semaphores at the user-level and which are 'invisible' to the scheduler
What does non determinism mean in the context of OS
You cant assume how a user will use the system
What is the turn type of this function declaration: void *producer (void *id);
a void pointer - this is a generic pointer type that can point to an object of any type
Which two registers define logical address space
base and limit base register contains the physical start address for the process The limit register contains the maximum logical address for the process
What are semaphores
blocking mechanisms that allow synchronisation
File space is allocated in
blocks (typically 512 - 8192)
A process encapsulates
code and state of a program
I/O is slow compared to
computation time
Bitmap
contains one bit (in memory) for each disk block to indicate whether block is in use
What is a page offset used for in address translation
defines physical memory address sent to the memory unit. Combined with base address
Describe the idea of wear levelling
distribute writes as evenly as possible across the NAND blocks so that it lasts longer
Give three semaphore operations
down(s) up(s) init(s, i)
what are the three atomic operators of semaphores?
down(s) up(s) also called P() init(s, i) also called V()
What is trashing
excessive paging activity causing low processor utilisation. Program repeatedly requests pages from secondary storage
GOT TO HERE! What does the initial value of a semaphore counter indicate
how many processes can access shared data at the same time The initial value defines how many processes can execute down without being blocked
The initial value of a semaphore counter indicates
how many processes can access shared data at the same time (defines how many processes can execute down without being blocked)
Where is the page table located?
in main memory
How many clock cycles does register access take?
in one CPU cycle (main memory can take many cycles)
What is a index block called in UNIX/Linux
inodes
What does IPC stand for
interprocess communication
What is lock contention
lock contention: this occurs whenever one process or thread attempts to acquire a lock held by another process or thread. The more fine-grained the available locks, the less likely one process/thread will request a lock held by the other. (For example, locking a row rather than the entire table, or locking a cell rather than the entire row.);
Modern disks use
logical sector addressing
Directory
maps symbolic file names to logical disk locations
What is a requirement of real concurrency
multiple processors
Calculate internal fragmentation when process size is 72,766 bytes
number of full pages = 35 Number of Bytes left over for page 36 = 1086 Internal fragmentation = 962 bytes
What is a race condition
occurs when multiple threads or processes read and write shared data and the final result depends on the relative timing of their execution on the exact process or thread interleaving
For a given address size of m-bits and page size 2^n bits how large is the page number (d) and page offset (d)
p = (m -n) bits d = n bits
If Valid-invalid bit is zero during address translation then what do you get?
page fault
How does logical address translate into physical address?
page number and page offset
Reading and writing can be done in what size chunks on SSDs
pages while erasing can be done over multiple pages
Idea behind the hierarchical page table
paging the page table if it is too big
The larger the time quantum for Round Robin the lower the
proportion of time taking up by context switching
terminal command to see processes
ps (htop is a more detailed version
Locks using busy waiting are called
spin locks
How do you deal with the fact that the number of processes that can be run is limited by available memory
swap processes temporarily out of memory to the backing store
The time interval from a process being submitted to the time it is completed is called the
turnaround time
What is a page number used for in address translation
used as an index into the page table, Page table has base address of pages in physical memory
Block size too small
wastes space for large files, high overhead in terms of management data, High file transfer time - seek time greater than transfer time
If no process is suspended in the Monitor, the signal operation will
will happen, but there is no recipient for the signal
Do both user level and kernel level threads have there own stack?
yes