www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

CS604 - FINAL TERM SUBJECTIVE WITH REFERENCE SOLVED BY UMAIR SAULAT

CS604- OPERATING SYSTEM

SOLVED SUBJECTIVE FOR FINAL EXAM

FALL SEMESTER 2012 SOLVED BY SYED M. UMAIR SAULAT MC100403250

Views: 2292

Attachments:

Replies to This Discussion

Thanks For Sharing......
Jazak ALLAH

Syed M. Umair Saulat Gud keep it up

Note: (This is Featured Discussion)

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

5 If pipe return -1 then what it meant ?

What is Reentrant code?

Syed M.Umair Saulat Plz Give answer of these question also...

If pipe return -1 then what it meant ?

The pipe() system call is used to create a read-write pipe that may
later be used to communicate with a process we'll fork off. The synopsis of the system
call is:
#include <unistd.h>
int pipe (int fd[2]);

The function returns -1 if the call fails.

What is Reentrant code?

In general, a re-entrant block of code is one that can be entered by another actor before an earlier invocation has finished, without affecting the path that the first actor would have taken through the code.Virtually any kind of recursive code could be classified as reentrant (i.e. you can call back into the same method without having finished it), but this is used in particular when talking about locks, mutex, semaphores etc.

thanks Aeysha MCs

thanks

Thanks Ayesha

CS604- OPERATING SYSTEM

SOLVED SUBJECTIVE FOR FINAL EXAM

FALL SEMESTER 2012

QNo.1   Scan Algorithm is sometimes called the elevator algorithm, why?

The Scan algorithm is sometimes called the elevator algorithm, since the disk arm behaves like an elevator in a building servicing all the requests (people at floors), going up and then reversing to service the requests going down.

REF :: handouts Page No. 244

QNo.2   What is basic logic in FIFO page replacement algorithm?

The simplest page-replacement algorithm is a FIFO algorithm. A FIFO replacement algorithm associates with each page the time when that page was brought into memory. When a page must be replaced, the oldest page is chosen.

REF :: handouts Page No. 199

QNo.3   What is mounting? Name two types of mounting. Give your answer with respect to File System?

Mounting makes file systems, files, directories, devices, and special files available for use at a particular location. Mount point is the actual location from which the file system is mounted and accessed. You can mount a file or directory if you have access to the file or directory being mounted and write permission for the mount point

There are types of mounts:

1. Remote mount
2. Local mount

REF :: handouts Page No. 226

QNo.4   Write three main characteristics memory management System?

1. The purpose of memory management is to ensure fair, secure, orderly, and efficient use of memory.
2. The task of memory management includes keeping track of used and free memory space, as well as when, where, and how much memory to allocate and deallocate.
3. It is also responsible for swapping processes in and out of main memory

REF :: handouts Page No. 151

QNo.5   Summarize the tradeoffs among simple arrays, trees, and hash tables as implementations of a page table.

Arrays

Arrays, lists and tables are often allocated more memory than they actually need. An array may be declared 100 by 100 elements even though it is seldom larger than 10 by 10 elements.

Hash Tables

This is a common approach to handle address spaces larger then 32 bits .Usually open hashing is used. Each entry in the linked list has three fields: page number, frame number for the page, and pointer to the next element

REF :: handouts Page No. 173, 186

QNo.6   How to implement hold and wait which can ensure that a deadlock will not occur?

A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other processes.

REF :: handouts Page No. 129

QNo.7   List down 2 major benefits of virtual memory

1. Virtual Memory is the separation of user logical memory from physical memory. This separation allows an extremely large virtual memory to be provided for programmers when only a smaller physical memory is available.
2. Virtual memory makes the task of programming easier because the programmer need not worry about the amount of physical memory,

REF :: handouts Page No. 186

QNo.7   what are the possible system for the input redirection in the UNIX/LINX system

Linux redirection features can be used to detach the default files from stdin, stdout, and stderr and attach other files with them for a single execution of a command. The act of detaching defaults files from stdin, stdout, and  stderr and attaching other files with them is known as input, output, and error redirection.

Here is the syntax for input redirection:

command < input-file or command 0< input-file

REF :: handouts Page No. 55

QNo.8   what is the purpose of “stub” in dynamic linking, give answer with respect to memory

With dynamic linking, a stub is included in the image for each library-routine reference. This stub is a small piece of code that indicates how to locate the appropriate memory-resident library routine or how to load the library if the routine is not already present. During execution of a process, stub is replaced by the address of the relevant library code and the code is executed .If library code is not in memory, it is loaded at this time

REF :: handouts Page No. 155

Dynamic linking requires potentially less time to load a program. Less disk space is needed to store binaries. However it is a time-consuming run-time activity, resulting in slower program execution.

REF :: handouts Page No. 156

QNo.10 what is use of mounting in file system

Mounting makes file systems, files, directories, devices, and special files available for use at a particular location. Mount point is the actual location from which the file system is mounted and accessed.

REF :: handouts Page No. 226

QNo.10 How operating attacks the" no preemption "condition necessary for feedback in order to solve the pro of deadlock

No preemption:

Resources cannot be preempted. That is, after using it a process releases a resource only voluntarily.

REF :: handouts Page No. 129

QNo.11 What is pager? Give answer with respect to virtual memory

A pager is concerned with the individual pages of a process. Thus the term pager is used in connection with demand paging.

When a process is to be swapped in, the paging software guesses which pages would be used before the process is swapped out again. Instead of swapping in a whole process, the pager brings only those necessary pages into memory.

REF :: handouts Page No. 187

QNo.12 what does the following command do in the LINX/UNIX operating system

\$mkdir ~/courses/cs604/program

Command creates the programs directory under your ~/courses/cs604 directory.

REF :: handouts Page No. 26

QNo.13 How you can differentiate between external and internal fragmentation

Fragmentation occurs in a dynamic memory allocation system when many of the free blocks are too small to satisfy any request.

External Fragmentation: External Fragmentation happens when a dynamic memory allocation algorithm allocates some memory and a small piece is left over that cannot be effectively used. If too much external fragmentation occurs, the amount of usable memory is drastically reduced. Total memory space exists to satisfy a request, but it is not contiguous.

Internal Fragmentation: Internal fragmentation is the space wasted inside of allocated memory blocks because of restriction on the allowed sizes of allocated blocks. Allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used

QNo.14 how page fault frequency can b used as a method of thrashing.

Page fault frequency is another method to control thrashing. Since thrashing has a high page fault rate, we want to control the page fault frequency. When it is too high we know that the process needs more frames. Similarly if the page-fault rate is too low, then the process may have too many frames. The operating system keeps track of the upper and lower bounds on the page-fault rates of processes. If the page-fault rate falls below the lower limit, the process loses frames. If page-fault rate goes above the upper limit, process gains frames. Thus we directly measure and control the page fault rate to prevent thrashing.

REF :: handouts Page No. 211

QNo.15 Three major frame allocation schemes?

There are three major allocation schemes:

1. Fixed allocation

In this scheme free frames are equally divided among processes

1. Proportional Allocation

Number of frames allocated to a process is proportional to its size in this scheme.

1. Priority allocation

Priority-based proportional allocation

REF :: handouts Page No. 205

QNo.16 Consider the round robin technique .do u think that the deadlock or starvation can happen in the round robin tech scheduling

No I don’t think so that the deadlock or starvation can happen in the round robin tech scheduling, because round-robin (RR) scheduling algorithm is designed especially for time-sharing systems. It is similar to FCFS scheduling but preemption is added to switch between processes. A small unit of time, called a time quantum (or time slice) is defined. The ready queue is treated as a circular queue. The CPU scheduler goes around the ready queue, allocating the CPU to each process for a time interval of up to 1 time quantum.

REF :: handouts Page No. 86

QNo.17 Explain the work of copy on write with respect to virtual memory.

Many child processes invoke the exec () system call immediately after creation, the copying of the parent’s address space may be unnecessary. Alternatively we can use a technique known as copy on write. This works by allowing the parent and child processes to initially share the same pages. These shared pages are marked as copy-on-write pages, meaning that if either process writes to a shared page, a copy of the shared page is created. REF :: handouts Page No. 194

QNo.18 Context switching

Switching the CPU from one process to another requires saving of the context of the current process and loading the state of the new process, this is called context switching.

REF :: handouts Page No. 31

QNo.19 Basic logic in FIFO page replacement algorithm

The simplest page-replacement algorithm is a FIFO algorithm. A FIFO replacement algorithm associates with each page the time when that page was brought into memory. When a page must be replaced, the oldest page is chosen. Notice that it is not strictly necessary to record the time when a page is brought in. We can create a FIFO queue to hold all pages in memory. We replace the page at the head of the queue. When a page is brought into memory we insert t at the tail of the queue.

REF :: handouts Page No. 199

QNo.20 Formula to find size of page table,

Page table size = NP * PTES

Where NP is the number of pages in the process address space and PTES is the page table entry size

REF :: handouts Page No. 166

QNo.21 File control block

A file control block is a memory data structure that contains most of the attributes of a file. In UNIX, this data structure is called inode (for index node).

REF :: handouts Page No. 233

QNo.21 One of the responsibilities of O.S is to use computer hardware efficiently, so look

Algorithm for disk scheduling,

One of the responsibilities of the operating system is to use the computer system hardware efficiently. For the

disk drives, meeting this responsibility entails having a fast access time and disk bandwidth.

Marks 3:

I. structure of 2-level page table,

ii.if a process exits but its threads are still running, will they continue?

REF :: handouts Page No. 243

QNo.22 one advantage and one disadvantage of using a large block size to store file data (NET),

Has lower overhead, so there is more room to store data.

Good for sequential access or very large rows

Permits reading a number of rows into the buffer cache with a single I/O (depending on row size and block size).

Wastes space in the buffer cache, if you are doing random access to small rows and have a large block size.  Not good for index blocks used in an OLTP

QNo.23 Three types of access modes and classes of users in UNIX protection, (P # 230)

UNIX recognizes three modes of access: read, write, and execute (r, w, x). The execute permission on a directory specifies permission to search the directory.

The three classes of users are:

• Owner: user is the owner of the file
• Group: someone who belongs to the same group as the owner
• Others: everyone else who has an account on the system

REF :: handouts Page No. 230

QNo.24 Possible criteria to decide that which process should be terminated while dead lock detection and recovery.

When a deadlock detection algorithm determines that a deadlock exists, several alternatives exist. One possibility is to inform the operator that a deadlock has occurred, and to let the operator deal with the deadlock manually. The other possibility is to let the system recover from the deadlock automatically. There are two options for breaking a deadlock. One solution is simply to abort one or more processes to break the circular wait. The second option is to preempt some resources from one or more of the deadlocked processes

REF :: handouts Page No. 149

QNo.25 what is mounting in the file system? And where is the mount point?

What is mounting? And what is Mount Point? (P#226)

Mounting makes file systems, files, directories, devices, and special files available for use at a particular location. Mount point is the actual location from which the file system is mounted and accessed. You can mount a file or directory if you have access to the file or directory being mounted and write permission for the mount point,

REF :: handouts Page No. 226

QNo.26 Define Roll in & Roll out with respect to swapping

A process needs to be in the memory to be executed. A process, however, can be swapped temporarily out of memory to a backing store, and then brought back into memory for continued execution. Backing store is a fast disk large enough to accommodate copies of all memory images for all users; it must provide direct access to these memory images. The system maintains a ready queue of all processes whose memory images are on the backing store or in memory and are ready to run. This technique is called roll out, roll in.

REF :: handouts Page No. 159

QNo.27 Explain the FIFO page algorithm with a scenario where the Belady’s anomaly true

The problem with this algorithm is that it suffers from Belady’s anomaly: For some page replacement algorithms the page fault rate may increase as the number of allocated 199

frames increases, whereas we would expect that giving more memory to a process would improve its performance.

REF :: handouts Page No. 199

 Deadlock Prevention: Deadlock Avoidance: Preventing deadlocks by constraining how requests for resources can be made in the system and how they are handled (system design). The goal is to ensure that at least one of the necessary conditions for deadlock can never hold. The system dynamically considers every request and decides whether it is safe to grant it at this point, The system requires additional apriority information regarding the overall potential use of each resource for each process. Allows more concurrency.

REF :: handouts Page No. 133

http://www.cs.jhu.edu/~yairamir/cs418/os4/tsld011.htm

QNo.29 Write one advantage and one disadvantage of using large size block

If you use larger block then relatively less overhead. Per I/O you can fetch more data. This is very good for sequential access, or very large rows.

Large block size is not good for index blocks used in an OLTP(Online Transaction Processing) type environment, because they increase block contention on the index leaf blocks.

QNo.30 Does cooperating processes are helpful to the operating system

The concurrent processes executing in the operating system may be either independent processes or cooperating processes. A process is independent if it cannot affect or be affected by any other process executing in the system. Clearly any process that shares data with other processes is a cooperating process.

REF :: handouts Page No. 41

QNo.31 how page fault frequency model used to control the thrashing

Page fault frequency is another method to control thrashing. Since thrashing has a high

page fault rate, we want to control the page fault frequency. When it is too high we know that the process needs more frames. Similarly if the page-fault rate is too low, then the process may have too many frames.

Establish “acceptable” page-fault rate

• If rate too low, process loses frame
• If rate too high, process gains frame

REF :: handouts Page No. 211

QNo.32 what is swap space?

The area on the disk where swapped out processes are stored is called the swap space.

REF :: handouts Page No. 34

QNo.32 writes the formula to calculate page table size

Page table size = NP * PTES , where NP is the number of pages in the process address space and PTES is the page table entry size (equal to |f| based on our discussion so far).

REF :: handouts Page No. 166

QNo.33 Name of two registers used in segmentation

Segment-table base register (STBR)

Segment-table length register (STLR) indicates

REF :: handouts Page No. 176

QNo.34 what is lazy analyzer that is use in virtual memory

When we want to execute a process, we swap it into memory. Rather than swapping the entire process into memory, however we use a lazy swapper

REF :: handouts Page No. 187

QNo.35 how to detect cycles in acyclic graph

A solution is to allow only links to files not subdirectories. Also every time a new link is added use a cycle detection algorithm to determine whether it is OK. If cycles are allowed, we want to avoid searching any component twice. A similar problem exists when we are trying to determine when a file can be deleted.

REF :: handouts Page No. 224

QNo.35 name three access modes use in file protection

2. Write
3. Execute

REF :: handouts Page No. 178

QNo.36 how to detect and recover deadlock

One method is to allow the system to enter a deadlocked state, detect it, and recover.

REF :: handouts Page No. 133

QNo.37 how semaphore algorithm works in n-critical problem 5marks

We can use semaphores to deal with the n-process critical section problem. The n processes share a semaphore, mutex (standing for mutual exclusion) initialized to 1. Each process Pi is organized as follows:

do

{

wait(mutex);

Critical section

signal(mutex);

Remainder section

} while(1);

As was the case with the hardware-based solutions, this is not a good solution because even though it satisfies mutual exclusion and progress, it does not satisfy bounded wait.

In a uni-processor environment, to ensure atomic execution, while executing wait and signal, interrupts can be disabled

REF :: handouts Page No. 109, 110

QNo.38 some way to reduce external fragmentation 2marks

External fragmentation of disk (similar to external fragmentation of main memory due to segmentation). Disk defragmenter utility needs to be used for removing external fragmentation.

REF :: handouts Page No. 235

QNo.39 Four characteristic of deadlock prevention 2 marks

1. Mutual exclusion
2. Hold and Wait
3. No preemption
4. Circular Wait

REF :: handouts Page No. 133 , 134

QNo.39 is starvation and deadlock are same. Accept or reject with solid reason 3 marks

No! Two neighbors are eating simultaneously; it nevertheless must be rejected because it has the possibility of creating a deadlock.

A set of processes are said to be in a deadlock state if every process is waiting for an event that can be caused only by another process in the set  and Starvation is infinite blocking caused due to unavailability of resources.

REF :: handouts Page No. 120,113

QNo.40 why we need medium term scheduling? 3marks

Medium-term scheduler, which removes processes from memory (and from active contention for the CPU) and thus reduces the degree of multiprogramming.
REF :: handouts Page No. 34

1. Deadlock prevention: is a set of methods for ensuring that at least one of the necessary conditions cannot hold. These methods prevent deadlocks by constraining how processes can request for resources.

1. Deadlock Avoidance: This method of handling deadlocks requires that processes give advance additional information concerning which resources they will request and use during their lifetimes. With this information, it may be decided whether a process should wait or not.

REF :: handouts Page No. 133

QNo.42 what is lazy analyzer that is use in virtual memory

When we want to execute a process, we swap it into memory. Rather than swapping the entire process into memory, however we use a lazy swapper

REF :: handouts Page No. 187

QNo.43 List down 2 major benefits of virtual memory

1. Virtual Memory is the separation of user logical memory from physical memory. This separation allows an extremely large virtual memory to be provided for programmers when only a smaller physical memory is available.
2. Virtual memory makes the task of programming easier because the programmer need not worry about the amount of physical memory

REF :: handouts Page No. 186

QNo.44 Possible criteria to decide that which process should be terminated while dead lock detection and recovery

When a deadlock detection algorithm determines that a deadlock exists, several alternatives exist. One possibility is to inform the operator that a deadlock has occurred, and to let the operator deal with the deadlock manually. The other possibility is to let the system recover from the deadlock automatically. There are two options for breaking a deadlock.

1. One solution is simply to abort one or more processes to break the circular wait.
2. The second option is to preempt some resources from one or more of the deadlocked processes

REF :: handouts Page No. 149

QNo.44 Some times mkfifo call may be failure,write the reasons for failure if mkfifo call in Unix?

Some of the reasons for this call to fail are:

1. File with the given name exists
2. Pathname too long
3. A component in the pathname not searchable, non-existent, or non-directory
5. Not enough memory space available
6. Signal caught during the execution of mknod()

REF :: handouts Page No. 57

QNo.45 what factors are determine to choose a process for Termination?

Many factors determine which process is chosen, including:

1. What the priority of the process is
2. How long the process has computed, and how much longer the process will compute before completing its designated task.
3. How many and what type of resources the process has used
4. How many resources the process needs in order to complete
5. How many processes will need to be terminated
6. Whether the process is interactive or batch

REF :: handouts Page No. 148 , 149

QNo.46 An address that is generated by CPU what is called? (2)

An address generated by the CPU is commonly referred to as a logical address,

REF :: handouts Page No. 153

QNo.47 What steps are needed for page replacement?

Steps needed for page Replacement is

1. Find the location of the desire page on the disk
2. Find a free frame
1. If there is a free frame use it.
2. If there is no free frame ,use a page replacement algorithm to select a victim frame
3. read the desired page into the newly freed frame; change the page and frame tables
4. Restart the user Process.

REF :: handouts Page No. 197

QNo.48 Define mounting in UNIX)

Mounting makes file systems, files, directories, devices, and special files available for use at a particular location.

REF :: handouts Page No. 226

QNo.49 CPU send the user or application request to the kernel. How kernels work on the request and fulfill it.

There are four events that cause execution of a piece of code in the kernel.

These events are:

1. Interrupt
2. Trap
3. System call
4. Signal.

Some kernel code is executed to service the corresponding event

REF :: handouts Page No. 14

QNo.50 Write the steps for converting source code to executable form.

Translation of a source program in a high-level or assembly language involves compilation and linking of the program series of steps:

Compile/Assemble

Execute

REF :: handouts Page No. 152

QNo.51 UNIX 3 modes of access. (Owner, group, others)

UNIX recognizes three modes of access: read, write, and execute (r, w, x). The execute permission on a directory specifies permission to search the directory.

The three classes of users are:

• Owner: user is the owner of the file
• Group: someone who belongs to the same group as the owner
• Others: everyone else who has an account on the system

REF :: handouts Page No. 230

QNo.51 Fg,bg commands

\$ bg

[1]+ find / -name foo -print 2> /dev/null &

\$ fg

find / -name foo -print 2> /dev/null

REF :: handouts Page No. 66

QNo.52 Disk scheduling SCAN and Look

In the C-Scan and C-Look algorithms, when the disk head reverses its direction, it moves all the way to the other end, without serving any requests, and then reverses again and starts serving requests. In other words, these algorithms serve requests in only one direction.

REF :: handouts Page No. 247

QNo.52 Hierarchical paging in Intel 80386

Most modern computers support a large logical address space: (232 to 264). In such an environment, the page table itself becomes excessively large

REF :: handouts Page No. 171

Compile time: if you know at compile where the process will reside in memory, the absolute addresses can be assigned to instructions and data by the compiler.

Load time: if it is not known at compile time where the process will reside in memory, then the compiler must generate re-locatable code. In this case the final binding is delayed until load time.

Execution time: if the process can be moved during its execution from one memory segment to another, then binding must be delayed until run time. Special hardware must be available for this to work

The size of a process is limited to the size of physical memory. To obtain better memory space utilization, we can use dynamic loading

REF :: handouts Page No. 155, 152

QNo.54 Safe and unsafe state, safe sequence

A state is safe if the system can allocate resources to each process in some order and still avoid a deadlock. More formally a system is in a safe state only if there exists a safe sequence. A sequence of processes <P1, P2… Pn> is a safe sequence for the current allocation state if, for each Pi, the resources that Pi can still request can be satisfied by the currently available  resources plus all the resources held by all the Pj with j < i. In this situation, if the resources that Pi needs are not immediately available, then Pi can wait until all Pj have finished. When they have finished, Pi can obtain all of its needed resources, complete its designated task, return its allocated resources and terminate. When Pi terminates, Pi+1 can obtain its needed resources and terminate. If no such sequence exists, then the system is said to be unsafe.

REF :: handouts Page No. 135

QNo.55 Hold and wait condition for Deadlocks

A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other processes.

REF :: handouts Page No. 129

QNo.56 Difference between Bounded wait and progress condition

Process:-

If no process is executing in its critical section and some processes wish to enter their critical sections, then only those processes that are not executing in their remainder section can participate in the decision on which will enter its critical section next, and this selection cannot be postponed indefinitely.

Bounded Waiting:-

There exists a bound on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted.

REF :: handouts Page No. 99

An address generated by the CPU is commonly referred to as a logical address,

REF :: handouts Page No. 153

QNo.58 Real time system definition

Real time systems are used when rigid time requirements are placed on the operation of a processor or the flow of data; thus it is often used as a control device in a dedicated application.

REF :: handouts Page No. 6

QNo.59 Issue with segmentation and solution

Segmentation may then cause external fragmentation (i.e. total memory space exists to satisfy a space allocation request for a segment, but memory space is not contiguous), when all blocks of memory are too small to accommodate a segment. In this case, the process may simply have to wait until more memory (or at least a larger hole) becomes available or until compaction creates a larger hole. Since segmentation is by nature a dynamic relocation algorithm, we can compact memory whenever we want. If we define each process to be one segment, this approach reduces to the variable sized partition scheme. T the other extreme, every byte could be put in its own segment and relocated separately. This eliminates external fragmentation altogether, however every byte would need a base register for its relocation, doubling memory use. The next logical step- fixed sized, small segments, is paging i.e. paged segmentation. Also it might latch a job in memory while it is involved in I/O. To prevent this I/O should be done only into OS buffers.

REF :: handouts Page No. 179

QNo.60 Problems in round robin with swapping 5 marks

Swapping is constrained by factors like quantum for RR scheduler and pending I/O for swapped out process. Assume that I/O operation was queued because the device was busy. Then if we were to swap out P1, and swap in process P2, the I/O operation might attempt to access memory that now belongs to P2.The solution to this problem are ever to swap out processes with pending I/O or to execute I/O in kernel space

REF :: handouts Page No. 158

QNo.61 Methods for process communication

A link is established automatically between every pair of processes that want to communicate. The processes need to know only each other’s identity to communicate

• A link is associated with exactly two processes.
• Exactly one link exists between each pair of processes

REF :: handouts Page No. 44

QNo.61 five attributes of File  3 marks

1. File Descriptor
2. Per Process File Descriptor Table
3. File Tablee
4. Inode Table
5. File’s contents

REF :: handouts Page No. 51

QNo.62 Mmap() command

“Normal” File I/O

fildes = open(...);

lseek(...);

/* use data in buf */

File I/O with mmap()

fildes = open(...)

/* use data at address */

REF:: handouts Page No. 196

QNo.63 The maximum number of pages in process address space is one million and the total address size (p +d) of process address space is 32- bit with page size is 4096 bytes. Calculate the number of bits required for page number (p) and the number of bits required for offset (d)?

P             =             12 bits

Off set =              5

Let the number of bits required                               =              x
so,          2^x         = 4096
so,          x              =12

Offset   = 5

2^p         = 4096

2^p         = 2^12

p             =12
2^d         = 32
2^d         =2^5

d             =5

QNo.64 what are the three stages/times when the address is bound to instructions and data?

Address can be bound to instructions and data at different times, as discussed below briefly.

1. Compile time: if you know at compile where the process will reside in memory, the absolute addresses can be assigned to instructions and data by the compiler.
2. Load time: if it is not known at compile time where the process will reside in memory, then the compiler must generate re-locatable code. In this case the final binding is delayed until load time.
3. Execution time: if the process can be moved during its execution from one memory segment to another, then binding must be delayed until run time. Special hardware must be available for this to work.

REF:: handouts Page No. 152

QNo.64 What is mounting and explain It.?

Mounting makes file systems, files, directories, devices, and special files available for use at a particular location. Mount point is the actual location from which the file system is mounted and accessed. You can mount a file or directory if you have access to the file or directory being mounted and write permission for the mount point

There are types of mounts:

1. Remote mount
2. Local mount

REF :: handouts Page No. 226

if it is not known at compile time where the process will reside in memory, then the compiler must generate re-locatable code. In this case the final binding is delayed until load time.

REF :: handouts Page No. 226

QNo.66 what is Index Allocation Method?

Indexed allocation brings all the pointers to the block together into a disk block, known as the index block.

REF :: handouts Page No. 236

QNo.67 Choose Preemptive and Non-Preemptive Scheduling from the following;
First-Come-First-Served (FCFS) Scheduling
Shorted Job First (SJF) Scheduling
Shortest Remaining Time First (SRTF) Scheduling
Priority Scheduling
Round-Robin Scheduling
Multilevel Queues Scheduling
Multilevel Feedback Queues Scheduling

 Preemptive and Non-Preemptive Shortest Remaining Time First (SRTF) Scheduling Round-Robin Scheduling First-Come, First Serve (FCFS or FIFO Shorted Job First (SJF) Scheduling

QNo.68 How can u display the status of suspended and background processes in Unix/Linux shell.?

You can use the fg command to resume the execution of a suspended job in the foreground or move a background job into the foreground. Here is the syntax of the command.

fg [%job_id]

REF :: handouts Page No. 65

QNo.69 Consider a logical address space of eight pages of 1024 words each, mamapped ont a

Physical memory of 32 frames.

(a)How many bits are there in the logical address?

(b)How many bits are there in the physical address? (5marks)

Each page/frame holds 1K; we will need 10 bits to uniquely address each of those 1024 addresses. Physical memory has 32 frames and we need 2 5 bits to address each frames, requiring in total 5+10=15 bits. A logical address space of 64 pages requires 6 bits to address each page uniquely, requiring 16bits in total.

REF :: http://garryowen.csisdmz.ul.ie/~cs4023/resources/sol11.pdf

QNo.70 Drawbacks of semaphore (5marks)

• Simple algorithms require more than one semaphore
• This increases the complexity of semaphore solutions to such algorithm
• The programmer must keep track of all calls to wait and to signal the semaphore.
• Since semaphores can be tricky, can we create other constructs from them?

REF :: http://www.cs.colostate.edu/~cs551/CourseNotes/ConcurrentConstructs...

An address generated by the CPU is commonly referred to as a logical address,

REF :: handouts Page No. 153

QNo.72 What is pager with respect to virtual memory? 2 marks

Whereas a pager is concerned with the individual pages of a process. Thus the term pager is used in connection with demand paging.

REF :: handouts Page No. 187

Real memory uses Physical addresses. These are the members that the memory chips react to on the bus. Virtual addresses are the logical addresses that refer to a process' address space. Thus, a machine with a 16-bit word can generate virtual addresses up to 64K, regardless of whether the machine has more or less memory than 64 KB

REF :: handouts Page No. 153

QNo.74 Define and briefly describe what is memory mapping system calls? 3calls

The memory mapping system calls can only support copy-on-write functionality allowing processes to share a file in read-only mode, but to have their own copies of any data they modify. So that access to the shared data is coordinated, the processes involved might use one of the mechanisms for achieving mutual exclusion.

mmap() System Call

In a UNIX system, mmap() system call can be used to request the operating system to

memory map an opened file. The following code snippets show “normal” way of doing

file I/O and file I/O with memory mapped files.

REF :: handouts Page No. 196

QNo.75 Consider a process having its segment 15 having 5096 bytes. The process generates a logical address (15, 3921). What page does the logical address refers to? (2 marks)

How many pages does the segment have?          ceiling[5096/1024]= 5

What page does the logical address refers to?   ceiling[3921/1024]= 4 (i.e., page number 3)

REF :: handouts Page No. 181

• Dynamic programming does not require special support from the operating system

REF :: handouts Page No. 154

QNo.77 Look algorithm ? (2 Marks)

This algorithm is a version of SCAN. In this algorithm the arm only goes as far as the last request in each direction, then reverses direction immediately, serving requests while going in the other direction. That is, it looks for a request before continuing to move in a given direction.
REF :: handouts Page No. 246

1

Latest Activity

Technical Guru updated their profile
1 hour ago
Technical Guru is now a member of Virtual University of Pakistan
1 hour ago
15 hours ago
monaliza and waseem are now friends
17 hours ago
Zubii joined + M.Tariq Malik's group

MTH401 Differential Equations

yesterday
Zubii joined + M.Tariq Malik's group

CS502 Fundamentals of Algorithms

yesterday
Zubii joined + M.Tariq Malik's group