当前位置:天才代写 > 作业代写 > 操作系统assignment代写 OS340代写

操作系统assignment代写 OS340代写

2022-11-01 11:40 星期二 所属: 作业代写 浏览:46

340A3

操作系统assignment代写 Question 1 For these questions consider a Unix like file system as on slide 11 of lecture 21 where the number of direct blocks is 12.

Question 1

For these questions consider a Unix like file system as on slide 11 of lecture 21 where the number of direct blocks is 12. Each block is 8KiB (8,192 bytes) and a block number consists of 8 bytes.

For all questions show your working. You may write a program to help calculate these answers. If you do this, include this program in the answer box below. Ensure that the program is clear with good comments. The markers will not run this program but they will read it to allocate marks for your working.

If you do not provide a program, please show your working in each question a) to e).

All numbers in the answers should be the number of bytes. Exact answers required. Each part is 2pts.

a) What is the maximum size for a file which does not use an indirect block?

b) What is the maximum size for a file which uses the single indirect block? (not the double or triple).

c) What is the maximum size for a file which uses the double indirect block? (not the triple).

d) What is the maximum size for a file in this system?

e) How many levels of indirection would be needed if we were to extend this file system to accommodate files up to 8 exbibyte (an exbibyte = 1024bytes) in size?

 

Question 2   操作系统assignment代写

Using the same file system as in Question 1 describe every block access (read or write) which is required to complete the tasks below.

The descriptions should be in the same order as the accesses. i.e. If you need data from a block before continuing you must describe the access to that block before continuing. Sometimes different orders will work. The markers will look for workable orders.

For access to a data block you should describe it like this:

1 read of block 4 to get bytes 25,000 to 25,100

Block numbers of the file start at 0. Byte positions in the file start at 0.

For access to an index block you should describe it like this:

1 read to get a block number from the single indirect block

or

2 reads to get a block number from the double indirect block and the corresponding index block

You do not need to specify the block numbers or the locations for indirect and index blocks.

Assumptions:     操作系统assignment代写

All read requests are valid. All write requests happen inside the existing file data, i.e. the file size will not change.

The inode for the file has been found and read into memory.

All blocks outside the inode are NOT in memory at the start of each task but if loaded once during the task they stay in memory until that task is completed.

File access times do NOT have to be written to the on disk inode.

File modified times do have to be written to the on disk inode.

The on disk inode occupies one block and several changes can be written with one write.

All device reads and writes work on individual blocks.

Tasks

a) Writing 100 bytes starting at byte position 8,100 of the file.

b) Reading 100 bytes starting at byte position 8,486,900 of the file.

 

Question 3   操作系统assignment代写

A file has 10 blocks. For each of the following requests calculate the number of disk accesses (both reads and writes need to be counted) which are required to satisfy the request under the three different allocation techniques. Put the answers in the table.

Each request is independent of the other requests. i.e. Each request starts from the initial file setup.

  • In the contiguous allocation technique the starting and length values are in memory. There is room to grow at both ends of the file. There is always enough space for the file somewhere on the disk.
  • In the linked technique the first and last block numbers are in memory. It is a doubly linked list of blocks. The last block holds the value -1 in its next block pointer. The first block holds the value -1 in its previous block pointer.
  • In the indexed technique the index block is in memory. The index is single-level.

You may assume changes to metadata about the file are only in memory. i.e. They do not require block accesses.

 

 

Block numbers start at zero.

  1. Read block number 5
  2. Read all even numbered blocks.
  3. Add a new block at the start of the file.
  4. Add a new block at the end of the file.
  5. Insert a new block between blocks number 4 and number 5.
  6. Remove the first block in the file.
  7. Remove the last block in the file.
  8. Remove all even numbered blocks. Do this in the most efficient way you can think of.
Request Contiguous allocation Linked allocation Indexed allocation
1
2
3
4
5
6
7
8

 

 

Question 4   操作系统assignment代写

Consider this global two-dimensional array stored in row-major order, 100 rows and 100 columns:

int A[][] = new int[100][100];

where A[0][0] is at location 256 in a paged memory system with pages of size 256. A small process that manipulates the array resides in page 0 (locations 0 to 255). Thus, every instruction fetch will be from page 0. Each integer in A occupies one memory location.

There are three frames. For the following questions use LRU replacement, and assume that frame 0 contains the process code and local variables of page 0, the other two are initially empty.

a) Say how many page faults are caused by the following code. Explain your answer.

for (int i = 0; i < 100; i++) 
  for (int j = 0; j < 100; j++)
    A[i][j] = 0;

b) Say how many page faults are caused by the following code. Explain your answer.

for (int j = 0; j < 100; j++) 
  for (int i = 0; i < 100; i++)
    A[i][j] = 0;

c) How do your answers in a) and b) relate to the concepts of “locality of reference” and “working sets”?’

 

Question 5   操作系统assignment代写

Here is an array with a page reference string in the header row. This machine has 4 frames. Initially all frames are free.

ref 1 2 3 1 2 1 7 6 5 7 4 7 1 7 4 5 3 6 7 2
free 1
free 2
free 3
free 7

Each following row shows the changes to the frame content over time for each frame in the machine.

Copy this array and paste it into the answer box 4 times. Fill the arrays in with the changes made using each of specified page replacement algorithms.

Show the cells which change as pages get replaced. The first 4 changes have been done for you. Each value you enter is the result of a page fault.

Only enter a number into the table if the corresponding frame changes its contents, it makes it easier for the marker to mark.

Algorithms

  1. FIFO – First In First Out
  2. LRU – Least Recently Used
  3. LFU – Least Frequently Used (if there are multiple pages with the same lowest frequency choose in a FIFO manner)
  4. Optimal (if there are multiple pages which are not used again choose in a FIFO manner).
操作系统assignment代写
操作系统assignment代写

 

 

 

 

更多代写:澳大利亚cs代写  托福网考代考  英国管理学课程作业代写   补充文书Essay代写  奥克兰paper代写  申请论文样本代写

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

 

天才代写-代写联系方式