Operating Systems Final
Consider the logical addresss 0xAEF9 with a page size of 256 bytes. What is the page number
0xAE
What are two advantages of modern operating systems decoupling a process address space from the machines physical memory?
1. If the memory needed is larger than the machines physical memory it can still run 2. process efficiency
Consider a logical address with a page size of 8KB. How many bits must be used to represent the page offset in the logical address?
13
Consider a 32 bit address for a two level paging system with a 16KB page size. The outer page table has 1024 entries. How many bits are used to represent the second level page table
16384 = 2^14 32-14= 18-10=8 8 bits
How many philosophers may eat simultaneously in the dining philosophers problem with 5 philosphers
2
suppose we have the following page acccesses: 1 2 3 4 2 3 4 1 2 1 1. suppose that there are also three frames within our system. using the fifo replacement algorithm, what will be the final configuration of the three frames following the execution of the given string?
4,1,2
What is a bootstrap program is where is it stored
A bootstrap program is the initial program that the computer runs when it is powered up or rebooted. It initializes all aspects of the system, from CPU registers to device controllers to memory contents. Typically, it is stored in read-only memory (ROM) or electrically erasable programmable read-only memory (EEPROM), known by the general term firmware, within the computer hardware.
Explain why an operating system can be viewed as a resource allocater
A computer system has many resources that may be required to solve a problem: CPU time, memory space, file-storage space, I/O devices, and so on. The operating system acts as the manager of these resources. Facing numerous and possibly conflicting requests for resources, the operating system must decide how to allocate them to specific programs and users so that it can operate the computer system efficiently and fairly.
What role do device drivers and device controllers play in an operating systsem
A general-purpose computer system consists of CPUs and multiple device controllers that are connected through a common bus. Each device controller is in charge of a specific type of device. The device controller is responsible for moving the data between the peripheral devices that it controls and its local buffer storage. Typically, operating systems have a device driver for each device controller. This device driver understands the device controller and presents a uniform interface for the device to the rest of the operating system.
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 to that hash to the same location. Each element consists of three fields: the virtual page number, the value of the mapped page frame, and a pointer to the next element in the linked list
Why is multi core processing more efficient than placing each processor on its own chip
A large reason why it is more efficient is that communication between processors on the same chip is faster than processors on separate chips.
How is a logical address translated into 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.
Explain the concept of a monolithic operating system
A monolithic os is one that acts as a single large entity. Processes all go through the same process on the same hard ware in order to be executed. This lead to having negative draw backs as it takes more time to clear information from the last process and to copy from the next one.
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.
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.
On all current computers, at least part of the interrupt handlers are written in assembly language, why?
Because some of the functions used by interrupt handlers are not supported by high level languages and it is more efficient to use asembly
Why are clustered systems considered to provide high-availability service
Clustered systems are considered high-availability in that these types of systems have redundancies capable of taking over a specific process or task in the case of a failure. The redundancies are inherent due to the fact that clustered systems are composed of two or more individual systems coupled together.
Why is direct memory access considered an efficient mechanism for performing I/O
DMA is efficient for moving large amounts of data between I/O devices and main memory. It is considered efficient because it removes the CPU from being responsible for transferring data. DMA instructs the device controller to move data between the devices and main memory.
Why do all file systems suffer from internal fragmentation?
Disk space is always allocated in fixed sized blocks. Whenever a file is written to disk, it usually does not fit exactly within an integer number of blocks so that a portion of a block is wasted when storing the file onto the device.
which scheduling algorithm must be non preemptive
FCFS or first come first serve
Briefly explain the functionality of extended file attributes.
File attributes are general values representing the name of a file, its owner, size and permissions. Extended file attributes refer to additional file attributes such as character encoding, security features, and application associated with opening the file.
What are the advantages of using file extensions?
File extensions allow the user of the computer system to quickly know the type of a file by looking at the files extension. The operating system can use the extension to determine how to handle a particular file
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 processes 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 ot the page.
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.
Explain the difference between asymmetric and symmetric multi processing
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.
Explain cache coherency
In multiprocessor environments, two copies of the same data may reside in the local cache of each CPU. Whenever one CPU alters the data, the cache of the other CPU must receive an updated version of this data. Cache coherency involves ensuring that multiple caches store the most updated version of the stored data.
There are two different ways that a command could be processed by a command interpreter. One way would be to have the shell contain the code needed to execute the command. The other way would be to implement the commands through exec calls, as in project 1. compare and contrast the two approaches. Use the date command as an example
In the first approach, upon the user issuing a command, the interpreter jumps to the appropriate section of code, executes the command, and returns control back to the user. In the second approach, the interpreter loads the appropriate program into memory along with the appropriate arguments. The advantage of the first method is speed and overall simplicity. The disadvantage to this technique is that new commands require rewriting the interpreter program which, after a number of modifications, may get complicated, messy, or too large. The advantage to the second method is that new commands can be added without altering the command interpreter. The disadvantage is reduced speed and the clumsiness of passing parameters from the interpreter to the system program.
In what way is an operating system like a government
It creates an environment within which other programs can do useful work
What will be the result of when a user issues the linux command grep truth document.txt?
It will send lines with truth included in them to stdout
Why is main memory not suitable for permanent program storage or backup purposes? Furthermore, what is the main disadvantage to storing information on a magnetic disk drive as opposed to main memory?
Main memory is a volatile memory in that any power loss to the system will result in erasure of the data stored within that memory. While disk drives can store more information permanently than main memory, disk drives are significantly slower.
What is the difference between an operating system that implements mandatory locking and one that implements advisory file locking?
Mandatory locking requires that the operating system not allow access to any file that is locked, until it is released, even if the program does not explicitly ask for a lock on the file. An advisory file locking scheme will not prevent access to a locked file, and it is up to the programmer to ensure that locks are appropriately acquired and released.
Linux permits process to share memory mapped files. Describe what memory-mapped files are and explain how they are shared
Memory mapped files are files that are stored within the main memory, the way they are shared is if one user edits the file it shows right away on the other users copies.
What are the challenges of multi threading on a multicore system
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.
What are the advantages and disadvantages of using a microkernel approach
One benefit of the microkernel approach is ease of extending the operating system. All new services are added to user space and consequently do not require modification of the kernel. The microkernel also provides more security and reliability, since most services are running as user — rather than kernel — processes. Unfortunately, microkernels can suffer from performance decreases due to increased system function overhead.
Explain the difference between parallelism and concurrency
Parallelism is accomplished by running 2 processes on 2 seperate processors. They execute at the same time. conccurency is similar, the end result of 2 completed process is the same, however the difference is that the two programs run on one cpu, switching between eachother.
Describe the differences between physical, virtual, and logical memory
Physical memory is the memory available for machines to execute operations (i.e., cache, random access memory, etc.). Virtual memory is a method through which programs can be executed that requires space larger than that available in physical memory by using disk memory as a backing store for main memory. Logical memory is an abstraction of the computer's different types of memory that allows programmers and applications a simplified view of memory and frees them from concern over memory-storage limitations.
what scheduling algorithm is approximated by prediciting the next cpu burst with an exponential average of the measured lengths of previous cpu bursts?
SJF
Briefly describe the segmentation memory management scheme. How does it differ from the paging memory management scheme in terms of users 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.
Explain the concept of starvation as it relates to process scheduling
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.
What are the advantages of using a higher level language to implement an operating system?
The advantages of using a higher level language is that it is much easier understood and implement by many people as well as when portinng the os to a new machine it can just be run through the compiler for the assembly language instead of re writing it for every machine you put it on so that is much more eficient
What is the biggest impediment to doing paging if the system has no TLB
The biggest impediment is the time it takes, with a TLB only one lookup is needed, without it is 2x slower
Explain the difference between the UNIX open and creat system calls
The creat system call is to create a completely new file so it would have to allocate memory, the open system call is simply looking for a file that already exists so it has to look in memory.
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.
Describe three common methods for remote file sharing
The first implemented method involves manually transferring files between machines via programs like ftp. The second major method uses a distributed file system (DFS), in which remote directories are visible from a local machine. In the third method, a browser is needed to access remote files on the world wide web, and separate operations are used to transfer files. The DFS method involves a much tighter integration between the machine that is accessing the remote files and the machine providing the files.
Explain the purpose of an interrupt vector
The interrupt vector is merely a table of pointers to specific interrupt-handling routines. Because there are a fixed number of interrupts, this table allows for more efficient handling of the interrupts than with a general-purpose, interrupt-processing routine.
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 shortterm 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.
Describe three general methods used to pass parameters to the operating system during system calls
The simplest approach is to pass the parameters in registers. In some cases, there may be more parameters than registers. In these cases, the parameters are generally stored in a block, or table, of memory, and the address of the block is passed as a parameter in a register. Parameters can also be placed, or pushed, onto the stack by the program and popped off the stack by the operating system.
Describe the relationship between an API, the system-call interface, and the operating system
The system-call interface of a programming language serves as a link to system calls made available by the operating system. This interface intercepts function calls in the API and invokes the necessary system call within the operating system. Thus, most of the details of the operating-system interface are hidden from the programmer by the API and are managed by the run-time support library.
Contiguous allocation of files leads to disk fragmentation, as mentioned in the text, because some space in the last disk block will be wasted in files whose length is not an integral number of blocks. Is this internal fragmentation of external? Make an analogy with something discussed in the chapter on memory management
This is internal fragmentation
Distinguish between virtualization and simulation
Virtualization is the process whereby the system hardware is virtualized, thus providing the appearance to guest operating systems and applications that they are running on native hardware. In many virtualized environments, virtualization software runs at near native speeds. Simulation is the approach whereby the actual system is running on one set of hardware, but the guess system is compiled for a different set of hardware. Simulation software must simulate — or emulate — the hardware that the guest system is expecting. Because each instruction for the guest system must be simulated in software rather than hardware, simulation is typically much slower than virtualization.
Explain the concept of a context switch
When a process is scheduled to run and it is time to switch to it a context switch is used. it saves the state of the currently running process so it can pick up where it left off and it restores the state of the next process to run and continues from that point
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.
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 memoryspace 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
What type of structure allows the sharing of sub directories and files
acyclic graph directory structure
explain aging and how aging can be used to prevent starvation
aging can be used to prevent starvation by giving the process a higher priority
What is the path name /home/people/os-student/chap11.txt an example of
an absolute path name
What is the difference between an absolute and relative path name?
an absolute path name begins at the root and follows a path of directories down to the specified file, giving the directory names on the path. An example is /home/osc/chap11/file.txt a relative path name defines a path from the current directory. If the current directory is /home/osc/ then the relative path name of chap11/file.txt refers to the same file as in the example of the absolute path name
Why should a web server not run as a single threaded process?
because it will only be able to process a single request at a time so the que for waiting will become extremely long
What is the dynamic storage allocation algorithm which results in the smallest leftover hole in memory.?
best fit
What is the biggest disadvantage of implementing threads in user space and why does it occur?
blocking occurs frequently in user space. threads evenly rely on I/O which causes delays and blocks other threads.
Which of the following statements is incorrect? a) an operating system provides an environment for the execution of programs b) an operating system manages system resources c) operating systems provide both command line as well as graphical user interfaces d) operating systems must provide both protection and security
c
What is optimal page replacement mostly used for
comparison with other page replacement schemes
What saves the state of the currently running process and restores the state of the next process to run
context switch
What allows the parent and child processes to initially share the same pages but when either process modifies a page, a copy of the shared page is created
copy on write
If you were creating an operating system to handle files, what would be the six basic file operations that you should implement?
creating a file, writing a file, reading a file, re positioning a file, deleting a file, and truncating a file
what refers to where a process is updating shared data
critical section
a mutex lock is
essentially a boolean variable
a counting semaphore is what
essentially an integer variable
in petersons solution what is the variable that indicates if a process is ready to enter its critical section?
flag[i]
What is beladys anomoly
for some page replacement algorithms, the page fault rate may increase as the number of allocated frames increases
the windows createProcess() system call creates a new process. the equivalent system call in unix is?
fork()
What are the four components of a computer system?
hardware, operating system, application programs, and users
what is the biggest advantage of implementing threads in user space and why does it occur?
increases efficiency by allowing user programs to be multiprogrammed. it occurs because a process can run several threads concurrently increasing performance
Which of the following is true of the direct access method
it allows programs to read and write records in no particular order
What is used on unix systems at the beginning of some files to roughly indicate the type of file?
magic number
Explain how multi programming increases cpu utilization
multi programming increases cpu utilization because it makes sure that the cpu always has something lined up to run making it much more efficient than if the cpu has idle time waiting for a process to request to use it.
Name and breifly describe the five different scheduling states a process goes through during execution
new - process has just been created ready - it is ready to recieve a job to preform waiting - waiting for cpu to do a given job running - using cpu and performing a job terminated - finished using cpu, job is complete
With paging a logical address consists of what two things
page number and an offset
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
What are the benefits of allowing a program that is only partially in memory to execute?
programs can be written to use more memory than is available in physical memory. CPU utilization and throughput is increased. Less I/O is needed to load or swap each user program into memory.
what scheduling algorithm is designed especially for time sharing systems
round robin or RR
With segmentation a logical address consists of what two things
segment number and an offset
what is the simplest file access method?
sequential access
What provides a portion of the system call interface for unix and linux
standard c library
what provides an interface to the services provided by an operating system
system calls
What is the difference between system and application programs
system programs are not part of the kernel, but are still associated with the operating system. Application programs are not associated with the operating of the system.
What in hardware does the mapping of a logical address to a physical address?
the MMU
when a child process is created, what is possible in terms of execution or address space of the child process?
the child process runs concurrently with the parent, the child process has a new program loaded into it, the child is a duplicate of the parent
What are common attributes that an operating system keeps track of and associates with a file?
the name, the identifier, the type of file, the location of the file, the files size, file protection, time date and user identification
what provides an api for creating and managing threads
thread library
what is the number of processes that are completed per time unit?
throughput
Explain the steps linux goes through to find the starting location of a file. Assume that it has been asked to access the file /home/user/bob/the/builder.tools for reading
to find the starting location of a file it has to trace from each node back to the root so it would start at the file itself and go up a level to find where that is contained until the root is found
What is the most common directory structure?
tree structure
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 average amount of time it takes for a process to be completed response time is how quickly a scheduling algorithm scheme responds to a request for cpu
the two separate modes of an operating system are
user and kernel
Physical memory is separated from logical memory in systems that support what?
virtual memory
when does a race condition occur
when several threads try to access and modify the same data concurrently
Which of the following operating systems is not open source
windows
What is an approximation of a programs locality?
working set
what is the dynamic storage allocation algorithm which results in the largest leftover hole in memory?
worst fit