25.03.2013 Views

Operating Systems, CS 571, Angelos Stavrou Sample Sample ...

Operating Systems, CS 571, Angelos Stavrou Sample Sample ...

Operating Systems, CS 571, Angelos Stavrou Sample Sample ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Operating</strong> <strong>Systems</strong>, <strong>CS</strong> <strong>571</strong>, <strong>Angelos</strong> <strong>Stavrou</strong><br />

<strong>Sample</strong> Theory QUESTIONS (Paging, File <strong>Systems</strong>, Security)<br />

1<br />

<strong>Sample</strong><br />

1. Consider a memory-management system based on paging. Let the total size of the<br />

physical memory be 2GB laid out over pages of size 4KB. Let the logical address space<br />

of each process be limited to 128MB.<br />

Based on the information above, determine the physical address layout in the system (i.e.,<br />

the total number of bits in a physical address, the number of bits specifying the physical<br />

frame number, and the number of bits specifying the page displacement). How many<br />

physical frames are there in the system?<br />

Determine the logical address layout in a similar way. How many pages are there in the<br />

logical address space of each process?<br />

Finally, compute the number of entries in each page table and the size of each page table<br />

entry.<br />

Answer:<br />

The total physical memory size is 2GB, so each physical address requires 31 bits. The<br />

page size is 4KB, requiring 12 bits of displacement in each address. Thus, the physical<br />

address layout is 31 bits, including 19 bits for the page frame number and 12 bits of<br />

displacement. Note that there are 512K page frames in the system.<br />

The logical address space for each process is 128MB, requiring a total of 27 bits. The<br />

page size is the same as that of the physical pages (i.e., 4KB). Therefore the logical<br />

address layout is 27 bits, with 15 bits for page number and 12 bits for displacement. Note<br />

that there are 32K pages in the address space of each process.<br />

Each page table should contain as many entries as there are logical pages in the address<br />

space of each process. Therefore, there are 32K entries in each page table. Each entry in a<br />

page table contains a valid/invalid bit and a page frame number. Since the page frame<br />

number has 19 bits, the length of each entry in the page table is 20 bits.<br />

2. Consider three memory-management systems S1, S2 and S3 that use simple paging for<br />

memory management and employ associative registers to speed up page lookups.<br />

Let S1 have a set of associative registers, with lookup performance of 120ns and a hit rate<br />

of 60%. Let S2 have a larger set of slower associative registers with lookup performance<br />

of 180ns and a hit rate of 80%. Let S3 have a set of associative registers with lookup<br />

performance of 120ns and a hit rate of 80%. Let the main-memory page-table lookup take<br />

600ns in all the three systems.


<strong>Operating</strong> <strong>Systems</strong>, <strong>CS</strong> <strong>571</strong>, <strong>Angelos</strong> <strong>Stavrou</strong><br />

2<br />

<strong>Sample</strong><br />

In terms of the lookup algorithm, let S3 employ the serial algorithm where the lookup is<br />

first conducted in the associative registers and only after the lookup miss in the<br />

associative registers, the main-memory lookup is initiated. In contrast, let S1 and S2<br />

employ the parallel algorithm where the lookup is conducted in parallel in both the<br />

associative registers and the main-memory page table.<br />

Determine the page-lookup performance for the three schemes. In particular, compute the<br />

average time for page lookup as well as the lookup time in the case of a page hit and a<br />

page miss. Based on this computation, identify the FALSE statement among the<br />

following.<br />

Answer:<br />

In the case of S1, it takes 120ns for a page lookup hit in the associative registers and<br />

600ns if there is a page miss. Thus, the overall performance (average page-lookup time)<br />

of S1 is 0.6 * 120 + 0.4 * 600 = 312ns.<br />

In the case of S2, it takes 180ns for a page lookup hit in the associative registers and<br />

600ns if there is a page miss. Thus, the overall performance (average page-lookup time)<br />

of S2 is 0.8 * 180 + 0.2 * 600 = 264ns.<br />

In the case of S3, it takes 120ns for a page lookup hit in the associative registers and<br />

720ns if there is a page miss (because it uses a serial lookup algorithm). Thus, the overall<br />

performance (average page-lookup time) of S3 is 0.8 * 120 + 0.2 * 720 = 240ns.<br />

Therefore, S3 has the best overall performance while S1 has the worst overall<br />

performance.<br />

3. Suppose a disk has size 128GB, and blocks are of size 64KB. If all block numbers are<br />

stored as 4-byte integers, how large must a main-memory file-allocation table (FAT) be?<br />

Answer:<br />

The number of table entries is 128GB divided by 64KB, and each entry takes 4 bytes.<br />

Thus the amount of main-memory space required by the FAT is 8MB.


<strong>Operating</strong> <strong>Systems</strong>, <strong>CS</strong> <strong>571</strong>, <strong>Angelos</strong> <strong>Stavrou</strong><br />

3<br />

<strong>Sample</strong><br />

4. Harry the Hacker has a list of 100,000 common passwords. He wants to use this list to<br />

break into a UNIX-like system that uses a password file with lines consisting of:<br />

1. The user's ID in plaintext.<br />

2. 10 bits of randomly chosen "salt," in plaintext.<br />

3. The user's password, concatenated with the salt, and then encrypted.<br />

This particular system has 50 users in its password file. Assume that the salt values are<br />

different for different users.<br />

Harry has just stolen this password file. In order to find all users who have chosen one of<br />

these 100,000 passwords, approximately how many encryptions of a passwordconcatenated-with-salt<br />

would Harry have to perform?<br />

Answer:<br />

Each of the 100,000 passwords must be encrypted with each of the salt values that appear<br />

in the password file, since any user could be using any of these passwords. Thus, the<br />

number of different encryptions needed is approximately 100,000*50 = 5 million.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!