Sale!

CSC 246 Homework 5 solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (2 votes)

Problem 1
Consider a disk with 5,000 cylinders. Assume that the tracks on one of its platters are numbered 0 to 4,999. The
disk arm is currently at cylinder 2,150 and the previous request was at cylinder 1,805.
1. List the orders with which the disk processes the following requests: 2,069; 1,212; 2,296; 2,800; 544; 1,618;
356; 1,523; 4,965; 3,681 with three different scheduling algorithms FCFS, SCAN, or C-SCAN.
2. Calculate the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests with each
scheduling algorithm.
Put your answers in problems.txt (ASCII file).
Problem 2
The following two questions are generated with the script vsfs.py, which is introduced at the end of Chapter 40.
Get yourself familiarized with the script by reading the corresponding README-vsfs and try some problems
generated by it. Then please answer the following eight questions.
Initial state:
inode bitmap 10000000
inodes [d a:0 r:2] [] [] [] [] [] [] []
data bitmap 10000000
data [(.,0) (..,0)] [] [] [] [] [] [] []
Which operation took place?
inode bitmap 11000000
inodes [d a:0 r:2] [f a:-1 r:1] [] [] [] [] [] []
data bitmap 10000000
data [(.,0) (..,0) (b,1)] [] [] [] [] [] [] []
Which operation took place?
inode bitmap 10000000
inodes [d a:0 r:2] [] [] [] [] [] [] []
CSC 246 Spring 2019 Homework 5 4/6/19, 6(03 PM
https://people.engr.ncsu.edu/gjin2/Classes/246/Spring2019/hw/hw5/index.html Page 2 of 3
data bitmap 10000000
data [(.,0) (..,0)] [] [] [] [] [] [] []
Which operation took place?
inode bitmap 11000000
inodes [d a:0 r:2] [f a:-1 r:1] [] [] [] [] [] []
data bitmap 10000000
data [(.,0) (..,0) (j,1)] [] [] [] [] [] [] []
Which operation took place?
inode bitmap 11000000
inodes [d a:0 r:2] [f a:1 r:1] [] [] [] [] [] []
data bitmap 11000000
data [(.,0) (..,0) (j,1)] [r] [] [] [] [] [] []
Which operation took place?
inode bitmap 10000000
inodes [d a:0 r:2] [] [] [] [] [] [] []
data bitmap 10000000
data [(.,0) (..,0)] [] [] [] [] [] [] []
Which operation took place?
inode bitmap 11000000
inodes [d a:0 r:2] [f a:-1 r:1] [] [] [] [] [] []
data bitmap 10000000
data [(.,0) (..,0) (c,1)] [] [] [] [] [] [] []
Which operation took place?
inode bitmap 11100000
inodes [d a:0 r:3] [f a:-1 r:1] [d a:1 r:2] [] [] [] [] []
data bitmap 11000000
data [(.,0) (..,0) (c,1) (d,2)] [(.,2) (..,0)] [] [] [] [] [] []
Which operation took place?
inode bitmap 11100000
inodes [d a:0 r:3] [f a:-1 r:2] [d a:1 r:2] [] [] [] [] []
data bitmap 11000000
data [(.,0) (..,0) (c,1) (d,2)] [(.,2) (..,0) (v,1)] [] [] [] [] [] []
Put your answers in problems.txt (ASCII file).
Problem 3
Write a program that lists files and directories in the given directory. When called without any arguments, the
CSC 246 Spring 2019 Homework 5 4/6/19, 6(03 PM
https://people.engr.ncsu.edu/gjin2/Classes/246/Spring2019/hw/hw5/index.html Page 3 of 3
program should just print the file and directory names. When invoked with the -l flag, the program should print out
information about each file and directory, such as the owner, group, permissions, and other information obtained
from the stat() system call. The program should take one additional argument, which is the directory to read, e.g.,
“myls -l directory”. If no directory is given, the program should just use the current working directory. Useful
interfaces: stat(), opendir(), readdir(), getcwd().
Note that this is one problem from OSTEP Chapter 39.
Expected output format are listed below. In total we will test four different commands: “./myls” and “./myls -l”, and
each may be supplied with an optional directory path. No specific order is required when you print out the names
under one directory.
eos$ ./myls [/optional/path/to/your/directory]
.
..
myls.c
myls
eos$ ./myls -l [/optional/path/to/your/directory]
drwx—— 2 gjin2 ncsu 2048 Wed Mar 27 18:46:05 2019 .
drwx—— 4 gjin2 ncsu 2048 Wed Mar 27 18:40:16 2019 ..
-rw——- 1 gjin2 ncsu 2553 Wed Mar 27 18:45:41 2019 myls.c
-rwx—— 1 gjin2 ncsu 9761 Wed Mar 27 18:46:05 2019 myls
After you finish, turn in your myls.c, README, and Makefile.