OS Midterm

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

AS 4.1 Provide two programming examples in which multithreading provides better performance than a single-threaded solution.

(1) A Web server that services each request in a separate thread. (2) (A parallelized application such as matrix multiplication where (different parts of the matrix may be worked on in parallel. (3) An (interactive GUI program such as a debugger where a thread is used (to monitor user input, another thread represents the running (application, and a third thread monitors performance.

AS 4.6 Provide two programming examples in which multithreading does not provide better performance than a single-threaded solution.

(1) Any kind of sequential program is not a good candidate to be threaded. An example of this is a program that calculates an individual tax return. (2) Another example is a "shell" program such as the C-shell or Korn shell. Such a program must closely monitor its own working space such as open files, environment variables, and current working directory.

AS 16.3 Describe four benefits of virtualization

1 )Virtualization provides Security and flexibility in operations : Security is provided with the help of firewalls.encryption is done to protect data from other threats. It helps in solving problems of recovering the data from crashed or corrupted devices. 2) Virtualization reduces the cost : It saves cost for physical systems such as hardware and servers. It reduces the wastage and decreases the maintenance cost. 3) Virtualization provides High availability and disaster recovery : While performing some operations might cause crash of system. This failure damage to the company.with the help of virtualization we can perform same tasks at same time in different machines.Data stored in cloud can retrieve any time.Even if a system crashes we can retrieve data from other system. 4) Virtualization provides flexibility in transfer of data: Data transfer in virtual machines has no limit and can be fast, easy with low cost. 5) Virtualization provides running of multiple operating systems on a single machine. 6) Virtualization allows the creation of a separate computing environments within the same host. This basic feature is used to reduce the number of active servers and limit power consumption.

AS 8.25 Consider a paging system with the page table stored in memory. a. If a memory reference takes 50 nanoseconds, how long does a paged memory reference take? b. If we add TLB s, and 75 percent of all page-table references are found in the TLB s, what is the effective memory reference time? (Assume that finding a page-table entry in the TLB s takes 2 nanoseconds, if the entry is present.)

100 nanoseconds; 50 nanoseconds to access the page table and 50 nanoseconds to access the word in memory. 75% * TLB hit-time + 25% * TLB miss-time + 2ns= 75% * 50ns + 25% * 100ns +2ns = 62.5ns

AS 9.1 Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault occurs.

A page fault occurs when an access to a page that has not been brought into main memory takes place. The operating system verifies the memory access, aborting the program if it is invalid. If it is valid, a free frame is located and I/O is requested to read the needed page into the free frame. Upon completion of I/O, the process table and page table are updated and the instruction is restarted.

AS 4.4 What resources are used when a thread is created? How do they differ from those used when a process is created?

Because a thread is smaller than a process, thread creation typically uses fewer resources than process creation. Creating a process requires allocating a process control block (PCB), a rather large data structure. The PCB includes a memory map, list of open files, and environment variables. Allocating and managing the memory map is typically the most time-consuming activity. Creating either a user or kernel thread involves allocating a small data structure to hold a register set, stack, and priority.

AS 1.27 Describe some of the challenges of designing operating systems for mobile devices compared with designing operating systems for traditional PCs.

The greatest challenges in designing mobile operating systems include: Less storage capacity means the operating system must manage memory carefully. The operating system must also manage power consumption carefully. Less processing power plus fewer processors mean the operating system must carefully apportion processors to applications

AS 15.5 An experimental addition to UNIX allows a user to connect a watchdog program to a file. The watchdog is invoked whenever a program requests access to the file. The watchdog then either grants or denies access to the file. Discuss two pros and two cons of using watchdogs for security.

The watchdog program becomes the primary security mechanism for file access. Because of this we find its primary benefits and detractions. A benefit of this approach is that you have a centralized mechanism for controlling access to a file - the watchdog program. By ensuring the watchdog program has sufficient security techniques, you are assured of having secure access to the file. However, this is also the primary negative of this approach as well - the watchdog program becomes the bottleneck. If the watchdog program is not properly implemented (i.e. it has a security hole), there are no other backup mechanisms for file protection. On what basis do you grant/deny access? Takes time, could change the watchdog policy

AS 17.2 Discuss the advantages and disadvantages of caching name translations for computers located in remote domains.

There is a performance advantage to caching name translations for computers located in remote domains: repeated resolution of the same name from different computers located in the local domain could be performed locally without requiring a remote name lookup operation. The disadvantage is that there could be inconsistencies in the name translations when updates are made in the mapping of names to IP addresses. These consistency problems could be solved by invalidating translations, which would require state to be managed regarding which computers are caching a certain translation and also would require a number of invalidation messages, or by using leases whereby the caching entity invalidates a translation after a certain period of time. The latter approach requires less state and no invalidation messages but might suffer from temporary inconsistencies.

AS 9.32 What is the cause of thrashing? How does the system detect thrashing? Once it detects thrashing, what can the system do to eliminate this problem?

Thrashing is caused by underallocation of the minimum number of pages required by a process, forcing it to continuously page fault. The system can detect thrashing by evaluating the level of CPU utilization as compared to the level of multiprogramming. It can be eliminated by reducing the level of multiprogramming.

AS 3.9 Describe the actions taken by a kernel to context-switch between processes.

Context switching between kernel threads typically requires saving the value of the CPU registers from the thread being switched out and restoring the CPU registers of the new thread being scheduled. 1. In response to a clock interrupt, the OS saves the PC and user stack pointer of the currently executing process, and transfers control to the kernel clock interrupt handler, 2. The clock interrupt handler saves the rest of the registers, as well as other machine state, such as the state of the floating point registers, in the process PCB. 3. The OS invokes the scheduler to determine the next process to execute, 4. The OS then retrieves the state of the next process from its PCB, and restores the registers. This restore operation takes the processor back to the state in which this process was previously interrupted, executing in user code with user mode privileges.

AS 8.11 Given six memory partitions of 300 KB , 600 KB , 350 KB , 200 KB , 750 KB , and 125 KB (in order), how would the first-fit, best-fit, and worst-fit algorithms place processes of size 115 KB , 500 KB , 358 KB , 200 KB , and 375 KB (in order)?

First-fit: 115 to 300, 500 to 600, 358 to 750, 200 to 350, 375 to 750 Best-fit: 115 to 125, 500 to 600, 358 to 750, 200 to 200, 375 to 750 Worst-fit: 115 to 750, 500 to 750, 358 to 600, 200 to 350, 375 must wait

e. Install more main memory.

Yes, this is likely to improve CPU utilization as there is more space to allocate processes to without having to page from secondary memory.

d. Decrease the degree of multiprogramming.

Yes, this will increase CPU utilization by allocating more frames of memory to each process. This will reduce thrashing and allow the process to get their pages more quickly.

AS 8.9. Explain the difference between internal and external fragmentation.

Internal fragmentation occurs when a process is allocated to a memory block which is larger than needed. The extra memory allocated cannot be used by other processes. External fragmentation occurs when there is enough total memory for a process to run, but the memory is not contiguous so it cannot use it.

AS 9.8 Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. How many page faults would occur for the following replacement algorithms, assuming ... five ... frames? Remember that all frames are initially empty, so your first unique pages will cost one fault each.

LRU replacement 8 FIFO replacement 10

b. Install a bigger paging disk.

No, having more capacity for the system to page out to will most likely worsen performance. Thrashing will likely occur if paging disk size increases.

c. Increase the degree of multiprogramming.

No, this will cause the system to allocate fewer frames of memory to each process. This may cause the number of page faults to increase.

a. Install a faster CPU

No, this will not improve CPU utilization as the main problem with this system is the amount of time spent paging to disk. A faster CPU would reduce the CPU utilization since it has to wait longer for new processes.

AS 3.5 When a process creates a new process using the fork() operation, which of the following states is shared between the parent process and the child process? a. Stack b. Heap c. Shared memory segments

Only the shared memory segments are shared between the parent process and the newly forked child process. Copies of the stack and the heap are made for the newly created process.

AS 8.22 What is the maximum amount of physical memory?

Size of Frames * Number of Frames or 2^N where n is number of bits

AS 4.8 Which of the following components of program state are shared across threads in a multithreaded process? a. Register values b. Heap memory c. Global variables d. Stack memory

The threads of a multithreaded process share heap memory and global variables. Each thread has its separate set of register values and a separate stack.

AS 8.31 Compare the segmented paging scheme with the hashed page table scheme for handling large address spaces. Under what circumstances is one scheme preferable to the other?

When a program occupies only a small portion of its large virtual address space, a hashed page table might be preferred due to its smaller size. The disadvantage with hashed page tables however is the problem that arises due to conflicts in mapping multiple pages onto the same hashed page table entry. If many pages map to the same entry, then traversing the list corresponding to that hash table entry could incur a significant overhead; such overheads are minimal in the segmented paging scheme where each page table entry maintains information regarding only one page.

AS 20.6 What conclusions can be drawn about the evolution of operating systems? What causes some operating systems to gain in popularity and others to fade?

answer


संबंधित स्टडी सेट्स

Biology 102 Final Set 3 Questions

View Set

Chapter 15 - Fetal Assessment During Labor (Maternity) EAQ's

View Set

230 test 1 leadership & nurse management

View Set

CH. 2 CYBERSECURITY THREAT LANDSCAPE

View Set

Chapter 22, Nursing Assessment: Integumentary System: Integ Assessment

View Set

Module 4 Quiz: Individual Influences

View Set

Unit 3 - Anatomy (Literal Suffering)

View Set