CSCE 451/851 Operating Systems Principles
Fall 1999
Steve Goddard
Homework 4/Study Aid
Due: never; this assignment need not be handed in.
However, your final will include at least one question from this assignment.
10, 11, 104, 170, 73, 309, 185, 245, 246, 434, 458, 364.
a) Give the reference string, assuming a page size of 100 bytes.
b) Find the page-fault rate for the reference string in part a, assuming 200 bytes of primary memory available to the program and a FIFO replacement algorithm.
c) Calculate what the page-fault rate would be if you used an LRU replacement algorithm.
d) Determine what the page-fault rate would be for the optimal replacement algorithm.
Segment |
Base |
Length |
0 |
219 |
600 |
1 |
2300 |
14 |
2 |
90 |
100 |
3 |
1327 |
580 |
4 |
1952 |
96 |
What are the physical addresses for logical addresses (0,430), (1,10), (1,11), (2,500), (3,400), and (4,112)?
(In the contiguous-allocation case, assume that there is no room to grow in the beginning, but there is room to grow in the end. Assume that the block information to be added is stored in memory.)
a) The block is added at the beginning.
b) The block is added in the middle.
c) The block is added at the end.
d) The block is removed from the beginning.
e) The block is removed from the middle.
f) The block is removed from the end.
These system calls behave as follows:
int create(name)
— this creates a file with the given name in the current working directory and returns an integer status code. If the return value is 0 then the create operation succeeded, if the value is -1, then the create operation failed. The operation can fail because a file with the same name already exists in the current working directory or if a disk I/O error occurs during the create operation.int unlink(name)
— this deletes a file with the given name from the current workingdirectory. (It’s called unlink because it "unlinks" the file’s i-node from the current working directory.) Like create(), an integer status code is returned. If the return value is 0 then the unlink operation succeeded, if the value is -1, then the operation failed. The unlink can fail because no file with the given name exists in the current working directory or if a disk I/O error occurs during the operation.a) Show how a binary semaphore can be implemented with the
create() and unlink() system calls.a) Explain the concept of file allocation based on cylinder groups?
b) Why are cylinder groups a good idea?
c) Prior to the use of cylinder groups, files were allocated (more or less) at random places on the disk. Compared with this scheme, are cylinder groups better or worse for storing: (explain your answers)
• small files (e.g., a simple e-mail message)
• medium size files (e.g., the source code for a program)
• very large files (e.g., an uncompressed, color image)