Wednesday, 28 October 2015

Operating systems Mid-2 Assignment Quetions with Answers

1.write about file Access methods?

A)⦁ There are several ways that the information in the file can be accessed. Some systems provide only one access method for files. On other systems, many different access methods are supported, and choosing the right one for a particular application is a major design problem.

Sequential Access:

Information in the file is processed in order, one record after the other. This is by far the most common mode of access of files. For example, computer editors usually access files in this fashion.

A read operation reads the next portion of the file and automatically advances the file pointer. Similarly, a write appends to the end of the file and the file pointer. Similarly, a write appends to the end of the file and the file pointer. Similarly, a write appends to the end of the end of the file and advances to the end of the newly written material (the new end of file). Such a file can be reset to the beginning, and, on some systems, a program may be able to skip forward or backward n records, for some integer n. This scheme is known as sequential access to a file. Sequential access is based on a tape model of a file.

Direct Access:


Direct access is based on a disk model of a file. For direct access, the file is viewed as a numbered sequence of block or records. A direct-access file allows arbitrary blocks to be read or written. Thus, after block 18 has been read, block 57 could be next, and then block 3. There are no restrictions on the order of reading and writing for a direct access file. Direct access files are of great use for intermediate access to large amounts of information.

Other Access Methods:


Other access methods can be built on top of a direct-access method. These additional methods generally involve the construction of an index for a file. The index contains pointers to the various blocks. To find an entry in the file, the index is searched first and the pointer is then used to access the file directly to find the desired entry.

With a large file, the index itself may become too large to be kept in memory. One solution is to create an index for the index file. The primary index file would contain pointers to secondary index files, which would point to the actual data items.

2. Explain about disk structure?

Disk structure

The actual physical details of a modern hard disk may be quite complicated. Simply, there are one or more surfaces, each of which contains several tracks, each of which is divided into sectors. There is one read/write head for every surface of the disk.
Also, the same track on all surfaces is knows as a 'cylinder'. When talking about movement of the read/write head, the cylinder is a useful concept, because all the heads (one for each surface), move in and out of the disk together.
We say that the "read/write head is at cylinder #2", when we mean that the top read-write head is at track #2 of the top surface, the next head is at track #2 of the next surface, the third head is at track #2 of the third surface, etc. 
The unit of information transfer is the sector (though often whole tracks may be read and written, depending on the hardware).
As far as most filesystems are concerned, though, the sectors are what matter. In fact we usually talk about a 'block device'. A block often corresponds to a sector, though it need not do: several sectors may be aggregated to form a single logical block.


3. Write about deadlock prevention methods?

The Methods 

■ Deadlock Prevention

■ Deadlock Avoidance

■ Deadlock Detection







4.What are the characteristics of deadlock?

Deadlock Characterization
■ Mutual exclusion: only one process at a time can use a
resource.
■ Hold and wait: a process holding at least one resource is
waiting to acquire additional resources held by other
processes.
■ No preemption: a resource can be released only
voluntarily by the process holding it, after that process has
completed its task.
■ Circular wait: there exists a set {P0, P1, …, P0} of waiting
processes such that P0 is waiting for a resource that is held
by P1, P1 is waiting for a resource that is held by
P2, …, Pn–1 is waiting for a resource that is held by
Pn, and P0 is waiting for a resource that is held by P0.
Deadlock can arise if four conditions hold simultaneously.

5.what is Access  matrix? give example?

Access Matrix

  • The model of protection that we have been discussing can be viewed as an access matrix, in which columns represent different system resources and rows represent different protection domains. Entries within the matrix indicate what access that domain has to that resource.

Figure 14.3 - Access matrix.
  • Domain switching can be easily supported under this model, simply by providing "switch" access to other domains:

Figure 14.4 - Access matrix of Figure 14.3 with domains as objects.
  • The ability to copy rights is denoted by an asterisk, indicating that processes in that domain have the right to copy that access within the same column, i.e. for the same object. There are two important variations:
    • If the asterisk is removed from the original access right, then the right is transferred, rather than being copied. This may be termed a transfer right as opposed to a copy right.
    • If only the right and not the asterisk is copied, then the access right is added to the new domain, but it may not be propagated further. That is the new domain does not also receive the right to copy the access.


0 comments:

Post a Comment

Featured Games

meletika © 2014 - Designed by Templateism.com, Plugins By MyBloggerLab.com | Published By Gooyaabi Templates