subject
Computers and Technology, 03.12.2019 17:31 tami5

141os is a very simple operating system that allows multiple users to save and print files. the 141os manages multiple disks, multiple printers, and multiple users - all of which can be considered concurrent processes. files can be stored on any disk and printed on any printer by any user. the goal of the system is to exploit possible parallelism to keep the devices (disks and printers) as busy as possible. this will be a two week assignment. the first part (due week 9) is to define the java classes for userthread, disk, and printer. the second part (due week 10) is to write printjobthread that manage printing a specified file and userthread that saves files to disk sectors. (note only one line of a file may be stored in a sector, so a file will require one sector per line.) although printers and disks can be thought of as parallel processes, i suggest you not make them threads. if you do, you must make them daemon threads by calling setdaemon or your program will never terminate.

1. define symbolic constants for number_of_users=4, number_of_disks=2, and number_of_printers=3. store instances of the appropriate objects in three separate arrays: users, printers, and disks.

2. a sample of the input (user*) and output (printer*) is in the hw8 directory located in my homework starts directory *** here ***. the printer* files will be generated by your program, but the exact files that get sent to each printer may vary. if you use a bufferedwriter, be sure you flush the buffer after each write.

hw8

design sketch part i: define class userthread, printer, disk, diskmanager, and directorymanager. only userthread will be derived from class thread. define class directorymanager that maps file names into disk sectors. you may want to define a diskmanager to keep track of the next free sector on each disk and to contain the directorymanager for finding file sectors on disk.

1. stringbuffer: implemented as an array of char, will be the standard unit stored on disks, sent to printers (one line at a time) and handled by users (again, one line at a time).

2. disks. each disk has a capacity specified to the constructor. the constructor must allocate all the stringbuffers (one per sector) when the disk is created and must not allocate any after that.

3. operation include the following:

class disk

{

static final int num_sectors = 1024;

stringbuffer sectors[] = new stringbuffer[num_sectors];
void write(int sector, stringbuffer data);

void read(int sector, stringbuffer data);

}

4. you can only read or write one line at a time, so to store a file, you must issue a write for each input line. you may implement it as an array of stringbuffers. we are using stringbuffers because strings are not modifyable. note also stringbuffer. equals must do a deep equality if you plan to do comparisons. reads and writes each take 200 miliseconds. you must sleep the thread that asks to print or read a sector.

5. note you can have only one user writing to a disk at a time or the files will be jumbled. you can have any number of threads reading at a time - even when someone is writing to the disk. (note this is not normally the case in a real os, i had to simplify the problem somehow.)

6. printer. each printer will write data to a file named printeri where i is the index of this printer. a printer can only handle one line of text at a time. you give it a line and it takes 2750 miliseconds to print. you'll have to sleep your the thread that asks to print to simulate this delay.

7. userthreads. each user will read from a file named useri where i is the index of this user. each useri file will contain a series of the following three commands. anything between a .save and a .end is part of the data in file x. userthreads will handle the command evaluation.
.save x
.end
.print x

8. the userthread will handle saving files to disk, but it will create a new printjobthread to handle each print request.

9. each userthread may have only one local stringbuffer to hold the current line of text. if you read strings from the input file, you must immediately copy that string into this single stringbuffer owned by the userthread. the userthread interprets the command in the stringbuffer or saves the stringbuffer to a disk as appropriate.

10. the directorymanager is a table that knows where files are stored on disk. the directorymanager operations are:

class directorymanager

{

hashtable t = new hashtable();

void enter(stringbuffer key, fileinfo file);

fileinfo lookup(stringbuffer key);

}

11. a fileinfo object will hold the disk number, length of the file (in sectors), and the index of the starting sector

class fileinfo

{

int disknumber;

int startingsector;

int filelength;

}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:40
You have a linux system that has a 1000gb hard disk drive, which has a 90gb partition containing an ext4 filesystem mounted to the / directory and a 4gb swap partition. currently, this linux system is only used by a few users for storing small files; however, the department manager wants to upgrade this system and use it to run a database application that will be used by 100 users. the database application and the associated data will take up over 200gb of hard disk space. in addition, these 100 users will store their personal files on the hard disk of the system. each user must have a maximum of 5gb of storage space. the department manager has made it very clear that this system must not exhibit any downtime as a result of hard disk errors. how much hard disk space will you require, and what partitions would you need to ensure that the system will perform as needed? where would these partitions be mounted? what quotas would you implement? what commands would you need to run and what entries to /etc/fstab would you need to create? justify your answers.
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
You wanted to look up information about alzheimer's, but you were unsure if it was spelled "alsheimer's" or "alzheimer's." which advanced search strategy would be useful? a) a boolean search b) using a wild card in your search c) trying different search engines d) doing a search for "alsheimer's not alzheimer's" asap. ill give brainlist.
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
What software programs are used to to create professional publication? a.) graphics programs b.) word processors c.) page layout programs d.) spreadsheet programs
Answers: 2
You know the right answer?
141os is a very simple operating system that allows multiple users to save and print files. the 141o...
Questions
question
Biology, 07.09.2021 15:50
question
History, 07.09.2021 15:50
question
Geography, 07.09.2021 15:50
question
English, 07.09.2021 15:50
question
Mathematics, 07.09.2021 15:50
question
Spanish, 07.09.2021 15:50
Questions on the website: 13722363