Final pt 1

0.0(0)
studied byStudied by 2 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/100

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

101 Terms

1
New cards
*CHAPTER 3 - PROCESSES*
2
New cards
Name and describe the different states that a process can exist in at any given time.
1) new, running, waiting, ready,
and terminated. The process is created while in the new state. In the
running or waiting state, the process is executing or waiting for an
event to occur, respectively. The ready state occurs when the process is
ready and waiting to be assigned to a processor and should not be
confused with the waiting state mentioned earlier. After the process is
finished executing its code, it enters the termination state.
3
New cards
Explain the main differences between a short-term and long-term scheduler.
The primary distinction between the two schedulers lies in the
frequency of execution. The short-term scheduler is designed to
frequently select a new process for the CPU, at least once every 100
milliseconds. Because of the short time between executions, the short term
scheduler must be fast. The long-term scheduler executes much less
frequently; minutes may separate the creation of one new process and the
next. The long-term scheduler controls the degree of multiprogramming.
Because of the longer interval between executions, the long-term
scheduler can afford to take more time to decide which process should be
selected for execution.
4
New cards
Explain the difference between an I/O-bound process and a CPU-bound process.
The differences between the two types of processes stem from the
number of I/O requests that the process generates. An I/O-bound process
spends more of its time seeking I/O operations than doing computational
work. The CPU-bound process infrequently requests I/O operations and
spends more of its time performing computational work.
5
New cards
Explain the concept of a context switch.
Whenever the CPU starts executing a new process, the old process's
state must be preserved. The context of a process is represented by its
process control block. Switching the CPU to another process requires
performing a state save of the current process and a state restore of a
different process. This task is known as a context switch. When a context switch occurs, the kernel saves the context of the old process in its PCB and loads the saves context of the new process scheduled to run.
6
New cards
Explain the fundamental differences between the UNIX fork() and Windows CreateProcess() functions.
Each function is used to create a child process. However, fork() has
no parameters; CreateProcess() has ten. Furthermore, whereas the child
process created with fork() inherits a copy of the address space of its
parent, the CreateProcess() function requires specifying the address
space of the child process.
7
New cards
Name the three types of sockets used in Java and the classes that implement them.
Connection-oriented (TCP) sockets are implemented with the Socket
class. Connectionless (UDP) sockets use the DatagramSocket class.
Finally, the MulticastSocket class is a subclass of the DatagramSocket
class. A multicast socket allows data to be sent to multiple recipients.
8
New cards
What is a loopback and when is it used?
A loopback is a special IP address: 127.0.0.1. When a computer
refers to IP address 127.0.0.1, it is referring to itself. When using
sockets for client/server communication, this mechanism allows a client
and server on the same host to communicate using the TCP/IP protocol.
9
New cards
Explain the purpose of external data representation (XDR).
Data can be represented differently on different machine
architectures (e.g., little-endian vs. big-endian). XDR represents data
independently of machine architecture. XDR is used when transmitting data
between different machines using an RPC.
10
New cards
Explain the term marshalling.
Marshalling involves the packaging of parameters into a form that
can be transmitted over the network. When the client invokes a remote
procedure, the RPC system calls the appropriate stub, passing it the
parameters provided to the remote procedure. This stub locates the port
on the server and marshals the parameters. If necessary, return values
are passed back to the client using the same technique.
11
New cards
Explain the terms "at most once" and "exactly once" and indicate how they relate to remote
procedure calls
Because a remote procedure call can fail in any number of ways, it
is important to be able to handle such errors in the messaging system. The term "at most once" refers to ensuring that the server processes a
particular message sent by the client only once and not multiple times.
This is implemented by merely checking the timestamp of the message. The
term "exactly once" refers to making sure that the message is executed on
the server once and only once so that there is a guarantee that the
server received and processed the message.
12
New cards
Describe two approaches to the binding of client and server ports during RPC calls.
First, the binding information may be predetermined, in the form of
fixed port addresses. At compile time, an RPC call has a fixed port
number associated with it. Second, binding can be done dynamically by a
rendezvous mechanism. Typically, an operating system provides a
rendezvous daemon on a fixed RPC port. A client then sends a message
containing the name of the RPC to the rendezvous daemon requesting the
port address of the RPC it needs to execute. The port number is
returned, and the RPC calls can be sent to that port until the process
terminates (or the server crashes).
13
New cards
*CHAPTER 4 - THREADS*
14
New cards
Why should a web server not run as a single-threaded process?
For a web server that runs as a single-threaded process, only one
client can be serviced at a time. This could result in potentially
enormous wait times for a busy server.
15
New cards
List the four major categories of the benefits of multithreaded programming. Briefly explain each.
The benefits of multithreaded programming fall into the categories:
responsiveness, resource sharing, economy, and utilization of
multiprocessor architectures. Responsiveness means that a multithreaded
program can allow a program to run even if part of it is blocked.
Resource sharing occurs when an application has several different threads
of activity within the same address space. Threads share the resources of
the process to which they belong. As a result, it is more economical to
create new threads than new processes. Finally, a single-threaded process
can only execute on one processor regardless of the number of processors
actually present. Multiple threads can run on multiple processors,
thereby increasing efficiency.
16
New cards
What are the two different ways in which a thread library could be implemented?
The first technique of implementing the library involves ensuring
that all code and data structures for the library reside in user space
with no kernel support. The other approach is to implement a kernel-level
library supported directly by the operating system so that the code and
data structures exist in kernel space.
17
New cards
Describe two techniques for creating Thread objects in Java.
One approach is to create a new class that is derived from the
Thread class and to override its run() method. An alternative — and more
commonly used — technique is to define a class that implements the
Runnable interface. When a class implements Runnable, it must define a
run() method. The code implementing the run() method is what runs as a
separate thread.
18
New cards
In Java, what two things does calling the start() method for a new Thread object accomplish?
Calling the start() method for a new Thread object first allocates
memory and initializes a new thread in the JVM. Next, it calls the run()
method, making the thread eligible to be run by the JVM. Note that the
run() method is never called directly. Rather, the start() method is
called, which then calls the run() method.
19
New cards
Some UNIX systems have two versions of fork(). Describe the function of each version, as well as
how to decide which version to use.
One version of fork() duplicates all threads and the other
duplicates only the thread that invoked the fork() system call. Which of
the two versions of fork() to use depends on the application. If exec()
is called immediately after forking, then duplicating all threads is
unnecessary, as the program specified in the parameters to exec() will
replace the process. If, however, the separate process does not call
exec() after forking, the separate process should duplicate all threads.
20
New cards
How can deferred cancellation ensure that thread termination occurs in an orderly manner as
compared to asynchronous cancellation?
In asynchronous cancellation, the thread is immediately cancelled
in response to a cancellation request. There is no insurance that it did
not quit in the middle of a data update or other potentially dangerous
situation. In deferred cancellation, the thread polls whether or not it
should terminate. This way, the thread can be made to cancel at a
convenient time.
21
New cards
What is a thread pool and why is it used?
A thread pool is a collection of threads, created at process
startup, that sit and wait for work to be allocated to them. This allows
one to place a bound on the number of concurrent threads associated with
a process and reduce the overhead of creating new threads and destroying
them at termination.
22
New cards
*CHAPTER 5 - CPU SYNCHRONIZATION*
23
New cards
Describe the difference between the fork() and clone() Linux system calls.
The fork() system call is used to duplicate a process. The clone()
system call behaves similarly except that, instead of creating a copy of
10
the process, it creates a separate process that shares the address space
of the calling process.
24
New cards
Multicore systems present certain challenges for multithreaded programming. Briefly describe
these challenges.
Multicore systems have placed more pressure on system programmers as
well as application developers to make efficient use of the multiple
computing cores. These challenges include determining how to divide
applications into separate tasks that can run in parallel on the
different cores. These tasks must be balanced such that each task is
doing an equal amount of work. Just as tasks must be separated, data must
also be divided so that it can be accessed by the tasks running on
separate cores. So that data can safely be accessed, data dependencies
must be identified and where such dependencies exist, data accesses must
be synchronized to ensure the safety of the data. Once all such
challenges have been met, there remains considerable challenges testing
and debugging such applications.
25
New cards
Distinguish between coarse-grained and fine-grained multithreading
There are two approaches to multithread a processor. (1) Coarsegrained
multithreading allows a thread to run on a processor until a
long-latency event, such as waiting for memory, to occur. When a longlatency
event does occur, the processor switches to another thread. (2)
Fine-grained multithreading switches between threads at a much finergranularity,
such as between instructions.
26
New cards
Explain the concept of a CPU-I/O burst cycle
The lifecycle of a process can be considered to consist of a number
of bursts belonging to two different states. All processes consist of CPU
cycles and I/O operations. Therefore, a process can be modeled as
switching between bursts of CPU execution and I/O wait.
27
New cards
*CHAPTER 6 - CPU SCHEDULING*
28
New cards
What role does the dispatcher play in CPU scheduling?
The dispatcher gives control of the CPU to the process selected by
the short-term scheduler. To perform this task, a context switch, a
switch to user mode, and a jump to the proper location in the user
program are all required. The dispatch should be made as fast as
possible. The time lost to the dispatcher is termed dispatch latency.
29
New cards
Explain the difference between response time and turnaround time. These times are both used to
measure the effectiveness of scheduling schemes.
Turnaround time is the sum of the periods that a process is spent
waiting to get into memory, waiting in the ready queue, executing on the
11
CPU, and doing I/O. Turnaround time essentially measures the amount of
time it takes to execute a process. Response time, on the other hand, is
a measure of the time that elapses between a request and the first
response produced.
30
New cards
What effect does the size of the time quantum have on the performance of an RR algorithm?
At one extreme, if the time quantum is extremely large, the RR
policy is the same as the FCFS policy. If the time quantum is extremely
small, the RR approach is called processor sharing and creates the
appearance that each of n processes has its own processor running at 1/n
the speed of the real processor.
31
New cards
Explain the process of starvation and how aging can be used to prevent it.
Starvation occurs when a process is ready to run but is stuck
waiting indefinitely for the CPU. This can be caused, for example, when
higher-priority processes prevent low-priority processes from ever
getting the CPU. Aging involves gradually increasing the priority of a
process so that a process will eventually achieve a high enough priority
to execute if it waited for a long enough period of time.
32
New cards
Explain the fundamental difference between asymmetric and symmetric multiprocessing.
In asymmetric multiprocessing, all scheduling decisions, I/O, and
other system activities are handled by a single processor, whereas in
SMP, each processor is self-scheduling.
33
New cards
Describe two general approaches to load balancing
With push migration, a specific task periodically checks the load
on each processor and — if it finds an imbalance—evenly distributes the
load by moving processes from overloaded to idle or less-busy processors.
Pull migration occurs when an idle processor pulls a waiting task from a
busy processor. Push and pull migration are often implemented in parallel
on load-balancing systems.
34
New cards
What is deterministic modeling and when is it useful in evaluating an algorithm?
Deterministic modeling takes a particular predetermined workload
and defines the performance of each algorithm for that workload.
Deterministic modeling is simple, fast, and gives exact numbers for
comparison of algorithms. However, it requires exact numbers for input,
and its answers apply only in those cases. The main uses of deterministic
modeling are describing scheduling algorithms and providing examples to
indicate trends.
35
New cards
Describe how trace tapes are used in distribution-driven simulations.
In a distribution-driven simulation, the frequency distribution
indicates only how many instances of each event occur; it does not
indicate anything about the order of their occurrence. Trace tapes can
correct this problem. A trace tape is created to monitor the real system
and record the sequence of actual events. This sequence then drives the
simulation. Trace tapes provide an excellent way to compare two
algorithms on exactly the same set of real inputs.
36
New cards
What three conditions must be satisfied in order to solve the critical section problem?
In a solution to the critical section problem, no thread may be
executing in its critical section if a thread is currently executing in
its critical section. Furthermore, only those threads that are not
executing in their critical sections can participate in the decision on
which process will enter its critical section next. Finally, a bound must
exist on the number of times that other threads are allowed to enter
their critical state after a thread has made a request to enter its
critical state.
37
New cards
Explain two general approaches to handle critical sections in operating systems.
Critical sections may use preemptive or nonpreemptive kernels. A
preemptive kernel allows a process to be preempted while it is running in
kernel mode. A nonpreemptive kernel does not allow a process running in
kernel mode to be preempted; a kernel-mode process will run until it
exits kernel mode, blocks, or voluntarily yields control of the CPU. A
nonpreemptive kernel is essentially free from race conditions on kernel
data structures, as the contents of this register will be saved and
restored by the interrupt handler.
38
New cards
Write two short functions that implement the simple semaphore wait() and signal() operations on
global variable S.
wait (S) {
while (S
39
New cards
Explain the difference between the first readers-writers problem and the second readers--writers
problem.
The first readers-writers problem requires that no reader will be
kept waiting unless a writer has already obtained permission to use the
shared database; whereas the second readers-writers problem requires that once a writer is ready, that writer performs its write as soon as
possible.
40
New cards
Describe the dining-philosophers problem and how it relates to operating systems.
The scenario involves five philosophers sitting at a round table
with a bowl of food and five chopsticks. Each chopstick sits between two
adjacent philosophers. The philosophers are allowed to think and eat.
Since two chopsticks are required for each philosopher to eat, and only
five chopsticks exist at the table, no two adjacent philosophers may be
eating at the same time. A scheduling problem arises as to who gets to
eat at what time. This problem is similar to the problem of scheduling
processes that require a limited number of resources.
41
New cards
How can write-ahead logging ensure atomicity despite the possibility of failures within a
computer system?
Write-ahead logging records information describing all the modifications made by the transaction to the various data it accessed. Each log record describes a single operation of a transaction write. Upon a failure of the computer system, the log can be used to recover using
both undo and redo procedures.
42
New cards
What overheads are reduced by the introduction of checkpoints in the log recovery system?
Whenever a system failure occurs, the log, if checkpoints are not
included, must be consulted in its entirety to determine those
transactions that need to be redone and undone. The entire log must be
processed to make these determinations. This is time consuming. Most of
the transactions that are redone are also not necessary due to
idempotency. Checkpoints reduce both of these overheads.
43
New cards
Describe the turnstile structure used by Solaris for synchronization.
Solaris uses turnstiles to order the list of threads waiting to
acquire either an adaptive mutex or a reader-writer lock. The turnstile
is a queue structure containing threads blocked on a lock. Each
synchronized object with at least one thread blocked on the object's lock
requires a separate turnstile. However, rather than associating a
turnstile with each synchronized object, Solaris gives each kernel thread
its own turnstile.
44
New cards
Define the two-phase locking protocol.
This protocol ensures serializability through requiring that each
transaction issue lock and unlock requests in two phases: a growing phase
and a shrinking phase. In the growing phase, a transaction may obtain
locks but not release a lock; whereas the shrinking phase allows the
14
release of locks but not the obtaining of new locks. Initially, a
transaction is in the growing phase.
45
New cards
Describe how an adaptive mutex functions
An adaptive mutex is used in the Solaris operating system to protect
access to shared data. On a multiprocessor system, an adaptive mutex acts
as a standard semaphore implemented as a spinlock. If the shared data
being accessed is already locked and the thread holding that lock is
running on another CPU, the thread spins while waiting for the lock to be
released, and the data to become available. If the thread holding the
lock is not in the run state, the waiting thread sleeps until the lock
becomes available. On a single processor system, spinlocks are not used
and the waiting thread always sleeps until the lock becomes available.
46
New cards
Describe a scenario when using a reader-writer lock is more appropriate than another
synchronization tool such as a semaphore.
A tool such as a semaphore only allows one process to access shared
data at a time. Reader-writer locks are useful when it is easy to
distinguish if a process is only reading or reading/writing shared data.
If a process is only reading shared data, it can access the shared data
concurrently with other readers. In the case when there are several
readers, a reader-writer lock may be much more efficient.
47
New cards
*CHAPTER 7 - DEADLOCKS*
48
New cards
Explain what has to happen for a set of processes to achieve a deadlocked state.
For a set of processes to exist in a deadlocked state, every
process in the set must be waiting for an event that can be caused only
be another process in the set. Thus, the processes cannot ever exit this
state without manual intervention.
49
New cards
Describe the four conditions that must hold simultaneously in a system if a deadlock is to occur.
For a set of processes to be deadlocked: at least one resource must
remain in a nonsharable mode, a process must hold at least one resource
and be waiting to acquire additional resources held by other processes,
resources in the system cannot be preempted, and a circular wait has to
exist between processes.
50
New cards
What are the three general ways that a deadlock can be handled?
A deadlock can be prevented by using protocols to ensure that a
deadlock will never occur. A system may allow a deadlock to occur, detect
it, and recover from it. Lastly, an operating system may just ignore the
problem and pretend that deadlocks can never occur.
51
New cards
What is the difference between deadlock prevention and deadlock avoidance?
Deadlock prevention is a set of methods for ensuring that at least
one of the necessary conditions for deadlock cannot hold. Deadlock
avoidance requires that the operating system be given, in advance,
additional information concerning which resources a process will request
and use during its lifetime.
52
New cards
Describe two protocols to ensure that the hold-and-wait condition never occurs in a system.
One protocol requires each process to request and be allocated all
its resources before it begins execution. We can implement this provision
by requiring that system calls requesting resources for a process precede
all other system calls. An alternative protocol allows a process to
request resources only when it has none. A process may request some
resources and use them. Before it can request any additional resources,
however, it must release all the resources that it is currently
allocated.
53
New cards
What is one way to ensure that a circular-wait condition does not occur?
One way to ensure that this condition never holds is to impose a
total ordering of all resource types, and to require that each process
requests resources in an increasing order of enumeration. This can be
accomplished by assigning each resource type a unique integer number to
determine whether one precedes another in the ordering.
54
New cards
What does a claim edge signify in a resource-allocation graph?
A claim edge indicates that a process may request a resource at
some time in the future. This edge resembles a request edge in direction,
but is represented in the graph by a dashed line.
55
New cards
Describe a wait-for graph and how it detects deadlock.
If all resources have only a single instance, then we can define a
deadlock-detection algorithm that uses a variant of the resourceallocation
graph, called a wait-for graph. We obtain this graph from the
resource-allocation graph by removing the resource nodes and collapsing
the appropriate edges. To detect deadlocks, the system needs to maintain
the wait-for graph and periodically invoke an algorithm that searches for
a cycle in the graph.
56
New cards
What factors influence the decision of when to invoke a detection algorithm?
The first factor is how often a deadlock is likely to occur; if
deadlocks occur frequently, the detection algorithm should be invoked
frequently. The second factor is how many processes will be affected by
deadlock when it happens; if the deadlock-detection algorithm is invoked
16
for every resource request, a considerable overhead in computation time
will be incurred.
57
New cards
Describe two methods for eliminating processes by aborting a process.
The first method is to abort all deadlocked processes. Aborting all
deadlocked processes will clearly break the deadlock cycle; however, the
deadlocked processes may have to be computed for a long time, and results
of these partial computations must be discarded and will probably have to
be recomputed later. The second method is to abort one process at a time
until the deadlock cycle is eliminated. Aborting one process at a time
incurs considerable overhead, since, after each process is aborted, a
deadlock-detection algorithm must be invoked to determine whether any
processes are still deadlocked.
58
New cards
Name three issues that need to be addressed if a preemption is required to deal with deadlocks
First, the order of resources and processes that need to be
preempted must be determined to minimize cost. Second, if a resource is
preempted from a process, the process must be rolled back to some safe
state and restarted from that state. The simplest solution is a total
rollback. Finally, we must ensure that starvation does not occur from
always preempting resources from the same process.
59
New cards
Describe how a safe state ensures deadlock will be avoided.
A safe state ensures that there is a sequence of processes to finish
their program execution. Deadlock is not possible while the system is in
a safe state. However, if a system goes from a safe state to an unsafe
state, deadlock is possible. One technique for avoiding deadlock is to
ensure that the system always stays in a safe state. This can be done by
only assigning a resource as long as it maintains the system in a safe
state.
60
New cards
*CHAPTER 8 - MAIN MEMORY*
61
New cards
What is the advantage of using dynamic loading?
With dynamic loading a program does not have to be stored, in its entirety, in main memory. This allows the system to obtain better memory-space utilization. This also allows unused routines to stay out of main memory so that memory can be used more effectively. For example, code used to handle an obscure error would not always use up main memory.
62
New cards
What is the context switch time, associated with swapping, if a disk drive with a transfer rate of 2 MB/s is used to swap out part of a program that is 200 KB in size? Assume that no seeks are necessary and that the average latency is 15 ms. The time should reflect only the amount of time necessary to swap out the process.
200KB / 2048 KB per second + 15 ms = 113 ms
63
New cards
When does external fragmentation occur?
As processes are loaded and removed from memory, the free memory space is broken into little pieces. External fragmentation exists when there is enough total memory space to satisfy a request, but the available spaces are not contiguous; storage is fragmented into a large number of small holes. Both the first-fit and best-fit strategies for memory allocation suffer from external fragmentation.
64
New cards
Distinguish between internal and external fragmentation.
: Fragmentation occurs when memory is allocated and returned to the system. As this occurs, free memory is broken up into small chunks, often too small to be useful. External fragmentation occurs when there is sufficient total free memory to satisfy a memory request, yet the memory is not contiguous, so it cannot be assigned. Some contiguous allocation schemes may assign a process more memory than it actually requested (i.e. they may assign memory in fixed-block sizes). Internal fragmentation occurs when a process is assigned more memory than it has requested and the wasted memory fragment is internal to a process
65
New cards
Explain the basic method for implementing paging.
Physical memory is broken up into fixed-sized blocks called frames while logical memory is broken up into equal-sized blocks called pages. Whenever the CPU generates a logical address, the page number and offset into that page is used, in conjunction with a page table, to map the request to a location in physical memory.
66
New cards
Describe how a transaction look-aside buffer (TLB) assists in the translation of a logical address to a physical address.
Typically, large page tables are stored in main memory, and a page-table base register points are saved to the page table. Therefore, two memory accesses are needed to access a byte (one for the page-table entry, one for the byte), causing memory access to be slowed by a factor of 2. The standard solution to this problem is to use a TLB, a special, small fast-lookup hardware cache. The TLB is associative, high speed memory. Each entry consists of a key and value. An item is compared with all keys simultaneously, and if the item is found, the corresponding value is returned.
67
New cards
How are illegal page addresses recognized and trapped by the operating system?
Illegal addresses are trapped by the use of a valid-invalid bit, which is generally attached to each entry in the page table. When this bit is set to "valid," the associated page is in the process's logical address space and is thus a legal (or valid) page. When the bit is set to "invalid," the page is not in the process's logical address space. The operating system sets this bit for each page to allow or disallow access to the page.
68
New cards
Describe the elements of a hashed page table.
A hashed page table contains hash values which correspond to a virtual page number. Each entry in the hash table contains a linked list of elements that hash to the same location (to handle collisions). Each element consists of three fields: (1) the virtual page number, (2) the value of the mapped page frame, and (3) a pointer to the next element in the linked list.
69
New cards
Briefly describe the segmentation memory management scheme. How does it differ from the paging memory management scheme in terms of the user's view of memory?
Segmentation views a logical address as a collection of segments. Each segment has a name and length. The addresses specify both the segment name and the offset within the segment. The user therefore specifies each address by two quantities: a segment name and an offset. In contrast, in a paging scheme, the user specifies a single address, which is partitioned by the hardware into a page number and an offset, all invisible to the programmer.
70
New cards
Describe the partitions in a logical-address space of a process in the IA-32 architecture.
The logical-address space is divided into two partitions. The first partition consists of up to 8 K segments that are private to that process. The second partition consists of up to 8 K segments that are shared among all the processes. Information about the first partition is kept in the local descriptor table (LDT); information about the second partition is kept in the global descriptor table (GDT).
71
New cards
How is a limit register used for protecting main memory?
When the CPU is executing a process, it generates a logical memory address that is added to a relocation register in order to arrive at the physical memory address actually used by main memory. A limit register holds the maximum logical address that the CPU should be able to access. If any logical address is greater than or equal to the value in the limit register, then the logical address is a dangerous address and an error results.
72
New cards
Using Figure 8.14, describe how a logical address is translated to a physical address.
A logical address is generated by the CPU. This logical address consists of a page number and offset. The TLB is first checked to see if the page number is present. If so, a TLB hit, the corresponding page frame is extracted from the TLB, thus producing the physical address. In the case of a TLB miss, the page table must be searched according to page number for the corresponding page frame.
73
New cards
Explain why mobile operating systems generally do not support paging.
Mobile operating systems typically do not support swapping because file systems are typically employed using flash memory instead of magnetic hard disks. Flash memory is typically limited in size as well as having poor throughput between flash and main memory. Additionally, flash memory can only tolerate a limited number of writes before it becomes less reliable.
74
New cards
Using Figure 8.26, describe how address translation is performed on ARM architectures.
ARM supports four different page sizes: 4-KB and 16-KB page use two-level paging, the larger 1-MB and 16-MB page sizes use single-level paging. The ARM architecture uses two levels of TLBs - at one level is the micro TLB which is in fact separate TLBs for data and instructions. At the inner level is a single main TLB. Address translation begins wit first searching the micro TLB, and in case of a TLB miss, the main TLB is then checked. If the reference is not in the main TLB, the page table must then be consulted.
75
New cards
*CHAPTER 9 - VIRTUAL MEMORY*
76
New cards
Explain the distinction between a demand-paging system and a paging system with swapping.
A demand-paging system is similar to a paging system with swapping where processes reside in secondary memory. With demand paging, when a process is executed, it is swapped into memory. Rather than swapping the entire process into memory, however, a lazy swapper is used. A lazy swapper never swaps a page into memory unless that page will be needed. Thus, a paging system with swapping manipulates entire processes, whereas a demand pager is concerned with the individual pages of a process.
77
New cards
Explain the sequence of events that happens when a page-fault occurs.
When the operating system cannot load the desired page into memory, a page-fault occurs. First, the memory reference is checked for validity. In the case of an invalid request, the program will be terminated. If the request was valid, a free frame is located. A disk operation is then scheduled to read the page into the frame just found, update the page table, restart the instruction that was interrupted because of the page fault, and use the page accordingly.
78
New cards
How is the effective access time computed for a demand-paged memory system?
In order to compute the effective access time, it is necessary to know the average memory access time of the system, the probability of a page fault, and the time necessary to service a page fault. The effective access time can then be computed using the formula:
effective access time = (1 - probability of page fault) * memory access time + probability of page fault * page fault time.
79
New cards
How does the second-chance algorithm for page replacement differ from the FIFO page replacement algorithm?
The second-chance algorithm is based on the FIFO replacement algorithm and even degenerates to FIFO in its worst-case scenario. In the second-chance algorithm, a FIFO replacement is implemented along with a reference bit. If the reference bit is set, then it is cleared, the page's arrival time is set to the current time, and the program moves along in a similar fashion through the pages until a page with a cleared reference bit is found and subsequently replaced.
80
New cards
Explain the concept behind prepaging.
Paging schemes, such as pure demand paging, result in large amounts of initial page faults as the process is started. Prepaging is an attempt to prevent this high level of initial paging by bringing into memory, at one time, all of the pages that will be needed by the process.
81
New cards
Why doesn't a local replacement algorithm solve the problem of thrashing entirely?
With local replacement, if one process starts thrashing, it cannot steal frames from another process and cause the latter to thrash as well. However, if processes are thrashing, they will be in the queue for the paging device most of the time. The average service time for a page fault will increase because of the longer average queue for the paging device. Thus, the effective access time will increase, even for a process that is not thrashing.
82
New cards
Explain the difference between programmed I/O (PIO) and interrupt driven I/O.
To send out a long string of bytes through a memory-mapped serial port, the CPU writes one data byte to the data register to signal that it is ready for the next byte. If the CPU uses polling to watch the control bit, constantly looping to see whether the device is ready, this method of operation is called programmer I/O. If the CPU does not poll the control bit, but instead receives an interrupt when the device is ready for the next byte, the data transfer is said to be interrupt driven.
83
New cards
What are the benefits of using slab allocation to allocate kernel memory?
The slab allocator provides two main benefits. First, no memory is wasted due to fragmentation. When the kernel requests memory for an object, the slab allocator returns the exact amount of memory required to represent the object. Second, memory requests can be satisfied quickly. Objects are created in advance and can be quickly allocated. Also, released objects are returned to the cache and marked as free, thus making them immediately available for subsequent requests.
84
New cards
How are lock bits useful in I/O requests?
A lock bit is associated with every frame. If a frame is locked, it cannot be selected for replacement. To write a block on tape, we lock into memory the pages containing the block. The system then continues as usual with other processes if the I/O request is in a queue for that I/O device. This avoids the replacement of the pages for other processes and the possible unavailability of those pages when the I/O request advances to the head of the device queue. When the I/O is complete, the pages are unlocked.
85
New cards
Explain how copy-on-write operates.
Copy-on-write (COW) initially allows a parent and child process to share the same pages. As long as either process is only reading—and not modifying—the shared pages, both processes can share the same pages, thus increasing system efficiency. However, as soon as either process modifies a shared page, a copy of that shared page is created, thus providing each process with its own private page. For example, assume an integer X whose value is 5 is in a shared page marked as COW. The parent process then proceeds to modify X, changing its value to 10. Since this page is marked as COW, a copy of the page is created for the parent process, which changes the value of X to 10. The value of X remains at 5 for the child process.
86
New cards
Explain the distinction between global allocation versus local allocation.
When a process incurs a page fault, it must be allocated a new frame for bringing the faulting page into memory. The two general strategies for allocating a new frame are global and local allocation policies. In a global allocation scheme, a frame is allocated from any process in the system. Thus, if process A incurs a page fault, it may be allocated a page from process B. The page that is selected from process B may be based upon any of the page replacement algorithms such as LRU. Alternatively, a local allocation policy dictates that when a process incurs a page fault, it must select one of its own pages for replacement when allocating a new page.
87
New cards
Discuss two strategies for increasing TLB reach.
TLB reach refers to the amount of memory accessible from the TLB and is the page size multiplied by the number of entries in the TLB. Two possible approaches for increasing TLB reach are (1) increasing the number of entries in the TLB, and (2) increasing the page size. Increasing the number of entries in the TLB is a costly strategy as the TLB consists of associative memory, which is both costly and power hungry. For example, by doubling the number of entries in the TLB, the TLB reach is doubled. However, increasing the page size (or providing multiple page sizes) allows system designers to maintain the size of the TLB, and yet significantly increase the TLB reach. For this reason, recent trends have moved towards increasing page sizes for increasing TLB reach.
88
New cards
What is the benefit of using sparse addresses in virtual memory?
Virtual address spaces that include holes between the heap and stack are known as sparse address spaces. Using a sparse address space is beneficial because the holes can be filled as the stack or heap segments grow, or when we wish to dynamically link libraries (or possibly other shared objects) during program execution.
89
New cards
Explain the usefulness of a modify bit.
A modify bit is associated with each page frame. If a frame is modified (i.e. written), the modify bit is then set. The modify bit is useful when a page is selected for replacement. If the bit is not set (the page was not modified), the page does not need to be written to disk. If the modify bit is set, the page needs to be written to disk when selected for replacement.
90
New cards
*CHAPTER 14 - PROTECTION*
91
New cards
Explain the meaning of the term object as it relates to protection in a computer system. What are the two general types of objects in a system?
A computer system is a collection of processes and objects. Each object has a unique name that differentiates it from all other objects in the system, and each can be accessed only through well-defined and meaningful operations. Objects are essentially abstract data types and include hardware objects (such as the CPU, memory segments, printer, and disks) and software objects (such as files, programs, and semaphores).
92
New cards
A process is said to operate within a protection domain which specifies the resources that the process may access. List the ways that a domain can be realized.
A domain may be realized where each user, process, or procedure may be a domain. In the first case, the set of objects that can be accessed depends on the identity of the user. In the second case, the set of objects that can be accessed depends upon the identity of the process. Finally, the third case specifies that the set of objects that can be accessed depends on the local variables defined with the procedure.
93
New cards
What is an access matrix and how can it be implemented?
An access matrix is an abstract model of protection where the rows represent domains and the columns represent objects. Each entry in the matrix consists of a set of access rights. Access matrices are typically implemented using a global table, an access list for objects, a capability list for domains, or a lock-key mechanism.
94
New cards
What was the main disadvantage to the structure used to organize protection domains in the MULTICS system?
The ring structure had the disadvantage in that it did not allow the enforcement of a need-to-know principle. For example, if an object needed to be accessible in one domain, but not in another, then the domain that required the privileged information needed to be located such that it was in a ring closer to the center than the other domain. This also forced every object in the outer domain to be accessible by the inner domain which is not necessarily desired.
95
New cards
Why is a global table implementation of an access matrix not typically implemented?
The global table implementation suffers from a couple of drawbacks that keep it from being a popular implementation type. The first drawback is that the table is usually large and cannot be stored in main memory. If the table cannot be stored in main memory, extra I/O must be used to access this table. In addition, a global table makes it difficult to take advantage of special groupings of objects or domains.
96
New cards
How does the lock-key mechanism for implementation of an access matrix work?
In a lock-key mechanism, each object is given a list of unique bit patterns, called locks. Similarly, each domain has a list of unique bit patterns, called keys. A process in a domain can only access an object if that domain has the matching key for the lock. Users are not allowed to examine or modify the list of keys (or locks) directly.
97
New cards
What is a confinement problem?
A confinement problem is the problem of guaranteeing that no information initially held in an object can migrate outside of its execution environment. Although copy and owner rights provide a mechanism to limit the propagation of access rights, they do not provide appropriate tools for preventing the propagation (or disclosure) of information. The confinement problem is in general unsolvable.
98
New cards
What is rights amplification with respect to the Hydra protection system?
Rights amplification allows certification of a procedure as trustworthy to act on a formal parameter of a specified type on behalf of any process that holds a right to execute the procedure. The rights held by the trustworthy procedure are independent of, and may exceed, the rights held by the calling process.
99
New cards
Describe the two kinds of capabilities in CAP.
Data capabilities only provide the standard read, write, and execute operations of the individual storage segments associated with the object. Data capabilities are interpreted by the microcode in the CAP machine. Software capabilities are protected, but not interpreted by the CAP microcode. These capabilities are interpreted by a protected procedure which may be written by an application programmer as part of a subsystem.
100
New cards
Explain how Java provides protection through type safety.
Java's load-time and run-time checks enforce type safety of Java classes. Type safety ensures that classes cannot treat integers as pointers, write past the end of an array, or otherwise access memory in arbitrary ways. Rather, a program can access an object only via the methods defined on that object by its class. This enables a class to effectively encapsulate its data and methods from other classes loaded in the same JVM.