Test material for Project 6

I have developed some test materials for project 6. Everything described here is either in the directory /cs/ingallsr/proj6testdir
or
/cs/ingallsr/proj6testdir2

proj6testdir

Here is the command file com.txt

import file1 file1.txt
mkdir dir1
import /dir1/file3 file3.txt
import dir1/file5 file5.txt
chdir dir1
export file3 copyoffile3
export ../file1 copyoffile1
export /dir1/file5 copyoffile5
import /file7 file7.txt
append file5 file6.txt
rename file5 file8
export file8 copyoffile8
quit

Before running the program, here is the contents of proj6testdir

total 24
-rw-r--r--  1 ingallsr  profs   283 Nov 12 14:53 com.txt
-rw-r--r--  1 ingallsr  profs    18 Nov 12 08:53 file1.txt
-rw-r--r--  1 ingallsr  profs   638 Nov 12 08:53 file3.txt
-rw-r--r--  1 ingallsr  profs   532 Nov 12 08:53 file5.txt
-rw-r--r--  1 ingallsr  profs    44 Nov 12 08:53 file6.txt
-rw-r--r--  1 ingallsr  profs  1270 Nov 12 14:47 file7.txt
After running the program, the contents of the directory looked like this.
-rw-r--r--  1 ingallsr  profs    283 Nov 12 14:53 com.txt
-rw-------  1 ingallsr  profs     18 Nov 12 15:06 copyoffile1
-rw-------  1 ingallsr  profs    638 Nov 12 15:06 copyoffile3
-rw-------  1 ingallsr  profs    532 Nov 12 15:06 copyoffile5
-rw-------  1 ingallsr  profs    576 Nov 12 15:06 copyoffile8
-rw-r--r--  1 ingallsr  profs   2783 Nov 12 15:06 dump.txt
-rw-r--r--  1 ingallsr  profs     18 Nov 12 08:53 file1.txt
-rw-r--r--  1 ingallsr  profs    638 Nov 12 08:53 file3.txt
-rw-r--r--  1 ingallsr  profs    532 Nov 12 08:53 file5.txt
-rw-r--r--  1 ingallsr  profs     44 Nov 12 08:53 file6.txt
-rw-r--r--  1 ingallsr  profs   1270 Nov 12 14:47 file7.txt
When run in verbose mode, the output to stdout looked like this
import file1 file1.txt
   putting MFR for file1 in block 2
mkdir dir1
   putting directory dir1 in block 3
import /dir1/file3 file3.txt
   putting MRF for file3 in block 4
   putting contents of /dir1/file3 in blocks 5 to 14
import dir1/file5 file5.txt
   putting MRF for file5 in block 15
   putting contents of dir1/file5 in blocks 16 to 24
chdir dir1
export file3 copyoffile3
export ../file1 copyoffile1
export /dir1/file5 copyoffile5
import /file7 file7.txt
   putting MRF for file7 in block 25
   putting contents of /file7 in blocks 26 to 45
append file5 file6.txt
   putting contents of file5 in blocks 46 to 46
rename file5 file8
export file8 copyoffile8
quit
Here is the contents of dump.txt
1 DL 4 .. 1 file1 2 dir1 3 file7 25 
2 RL 18 This is file1.txt 
3 DL 3 .. 1 file3 4 file8 15 
4 RB 638 5 10 
5 Let's write a simulation of a file system.  Since this does not 
6 require any system calls, you can use whatever language you want
7 .  Make sure that you have a comment at the top telling the grad
8 ers how to compile and run your program.    All data for all fil
9 es, including the Master File Records and the freelist, will be 
10 stored on the disk.  The disk consists of 256 blocks; each block
11  has 64 bytes.  We will use a simplified implementation of the N
12 TFS file system.  You might want to reread section 11.8, althoug
13 h we will not be implementing many of these features.  In our sy
14 stem, each file will have a 64 bit Master File Record (MFR).  
15 RB 576 16 9 46 1 
16 The history of computing and the history of operating systems ar
17 e intimately intertwined  One of the best ways to understand why
18  an operating system is important is to get an understanding of 
19 what computers looked like before modern operating system concep
20 ts were developed.  The earliest computers, such as the ENIAC of
21  the 1940s, had no programming languages, not even assemblers, a
22 nd did not even have stored programs. They were programmed by se
23 tting switches or plugboards similar to early telephone switchbo
24 ards for each run.   A block can hold one of four structures:   
25 RB 1270 26 20 
26 When two trains approach each other at a crossing, both shall co
27 me to a full stop and neither shall start up again until the oth
28 er has gone. (Statute passed by the Kansas Legislature)  Recall 
29 that one definition of an operating system is a resource allocat
30 or. There are many resources that can be allocated to only one p
31 rocess at a time, and we have seen several operating system feat
32 ures that allow this, such as mutexes, semaphores or file locks.
33   Sometimes a process has to reserve more than one resource. For
34  example, a process which copies files from one tape to another 
35 generally requires two tape drives. A process which deals with d
36 atabases may need to lock multiple records in a database.  In ge
37 neral, resources allocated to a process are not preemptable; thi
38 s means that once a resource has been allocated to a process, th
39 ere is no simple mechanism by which the system can take the reso
40 urce back from the process unless the process voluntarily gives 
41 it up or the system administrator kills the process. This can le
42 ad to a situation called deadlock. A set of processes or threads
43  is deadlocked when each process or thread is waiting for a reso
44 urce to be freed which is controlled by another process. Here is
45  an example of a situation where deadlock can occur.  
46 

This does not test all of the required functionality yet. I hope to have a more complex example shortly, but this should help many of you to get started.

proj6testdir2

This tests all of the commands

Here is the command file commands3.txt

import aaa aaa.txt
mkdir dir1
import dir1/bbb bbb.txt
chdir dir1
import ccc ccc.txt
mkdir dir2
import dir2/ddd ddd.txt
chdir ..
chdir ..
import one one.txt
mkdir dir3
import dir3/fff fff.txt
append one two.txt
export one copyofone
export dir1/bbb copyofbbb
rename aaa ggg
copy dir1/bbb hhh
export hhh copyofbbb
export ggg copyofggg
delete ggg
rmdir dir1
quit

When the program is run in verbose mode, here is what is written to stdout.

import aaa aaa.txt
   putting MRF for aaa in block 2
   putting contents of aaa in blocks 3 to 4
mkdir dir1
   putting directory dir1 in block 5
import dir1/bbb bbb.txt
   putting MRF for bbb in block 6
   putting contents of dir1/bbb in blocks 7 to 10
chdir dir1
import ccc ccc.txt
   putting MFR for ccc in block 11
mkdir dir2
   putting directory dir2 in block 12
import dir2/ddd ddd.txt
   putting MFR for ddd in block 13
chdir ..
chdir ..
import one one.txt
   putting MRF for one in block 14
   putting contents of one in blocks 15 to 24
mkdir dir3
   putting directory dir3 in block 25
import dir3/fff fff.txt
   putting MRF for fff in block 26
   putting contents of dir3/fff in blocks 27 to 32
append one two.txt
   putting contents of one in blocks 33 to 44
export one copyofone
export dir1/bbb copyofbbb
rename aaa ggg
copy dir1/bbb hhh
   putting MFR for hhh in block 45
   putting contents of hhh in blocks 46 to 49
export hhh copyofbbb
export ggg copyofggg
delete ggg
rmdir dir1
quit

and here is the file dump.txt

1 DL 4 .. 1 one 14 dir3 25 hhh 45 
14 RB 1397 15 10 33 12 
15 Let's write a simulation of a file system.  Since this does not 
16 require any system calls, you can use whatever language you want
17 . Make sure that you have a comment at the top telling the grade
18 rs how to compile and run your program.  All data for all files,
19  including the Master File Records and the freelist, will be sto
20 red on the disk.  The disk consists of 256 blocks; each block ha
21 s 64 bytes.  We will use a simplified implementation of the NTFS
22  file system.  You might want to reread section 11.8, although w
23 e will not be implementing many of these features.  In our syste
24 m, each file will have a 64 bit Master File Record (MFR).  A blo
25 DL 2 .. 1 fff 26 
26 RB 360 27 6 
27 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
28 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
29 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
30 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
31 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
32 fff fff fff fff fff fff fff fff fff fff 
33 ck can hold one of four structures:  A Master File Record} (one 
34 per file) This has an R (for regular file) in the first byte.  T
35 he second byte will hold either a B (for big) or an L (for littl
36 e).  The third and fourth bytes are a short int containing the n
37 umber of bytes in the file.  A little file is a file with less t
38 han 61 bytes and is stored completely in the MFR (NTFS does this
39 , although the sizes are different).  A big file is a file which
40  has 61 or more bytes and is stored in separate blocks.  To impl
41 ement a big file, you will use runs.  Each run consists of the s
42 tarting block and the number of contiguous blocks.  These should
43  be stored as consecutive pairs of short ints in the remainder o
44 f the MFR block.  There should be room for 15 pairs. 
45 RB 226 46 4 
46 bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb  bbb bbb bbb bbb bbb
47  bbb bbb bbb bbb bbb bbb  bbb bbb bbb bbb bbb bbb bbb bbb bbb bb
48 b bbb  bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb  bbb bbb bbb 
49 bbb bbb bbb bbb bbb bbb bbb bbb   


A third test directory

The directory /cs/ingallsr/proj6testdir3 is an even more complete test of the project.

Here is the output when run with the command a.out commands3.txt -V

import aaa aaa.txt
   putting MRF for aaa in block 2
   putting contents of aaa in blocks 3 to 4
mkdir dir1
   putting directory dir1 in block 5
import dir1/bbb bbb.txt
   putting MRF for bbb in block 6
   putting contents of dir1/bbb in blocks 7 to 10
chdir dir1
import ccc ccc.txt
   putting MFR for ccc in block 11
mkdir dir2
   putting directory dir2 in block 12
import dir2/ddd ddd.txt
   putting MFR for ddd in block 13
chdir ..
chdir ..
import one one.txt
   putting MRF for one in block 14
   putting contents of one in blocks 15 to 24
mkdir dir3
   putting directory dir3 in block 25
import dir3/fff fff.txt
   putting MRF for fff in block 26
   putting contents of dir3/fff in blocks 27 to 32
append one two.txt
   putting contents of one in blocks 33 to 44
export one copyofone
export dir1/bbb copyofbbb
rename aaa ggg
copy dir1/bbb hhh
   putting MFR for hhh in block 45
   putting contents of hhh in blocks 46 to 49
export hhh copyofbbb
export ggg copyofggg
delete ggg
rmdir dir1
import /dir3/hamlet hamlet.txt
   putting MRF for hamlet in block 2
   putting contents of /dir3/hamlet in blocks 50 to 64
import /dir3/jjj jjj.txt
   putting MRF for jjj in block 3
   putting contents of /dir3/jjj in blocks 4 to 9
import /dir3/kkk kkk.txt
   putting MRF for kkk in block 10
   putting contents of /dir3/kkk in blocks 65 to 70
append /dir3/hamlet hamlet2.txt
   putting contents of hamlet in blocks 71 to 82
copy /dir3/hamlet /copyham
   putting MFR for copyham in block 11
   putting contents of copyham in blocks 83 to 109
delete /dir3/hamlet
export /copyham copyofhamlet.txt
mkdir dir4
   putting directory dir4 in block 2
chdir dir4
import three three.txt
   putting MRF for three in block 12
   putting contents of three in blocks 50 to 51
quit

Here is the file dump.txt

1 DL 6 .. 1 one 14 dir3 25 hhh 45 copyham 11 dir4 2 
2 DL 2 .. 1 three 12 
3 RB 336 4 6 
4 This is jjj This is jjj This is jjj This is jjj This is jjj This
5  is jjj This is jjj This is jjj This is jjj This is jjj This is 
6 jjj This is jjj This is jjj This is jjj This is jjj This is jjj 
7 This is jjj This is jjj This is jjj This is jjj This is jjj This
8  is jjj This is jjj This is jjj This is jjj This is jjj This is 
9 jjj This is jjj 
10 RB 337 65 6 
11 RB 1722 83 27 
12 RB 120 50 2 
14 RB 1397 15 10 33 12 
15 Let's write a simulation of a file system.  Since this does not 
16 require any system calls, you can use whatever language you want
17 . Make sure that you have a comment at the top telling the grade
18 rs how to compile and run your program.  All data for all files,
19  including the Master File Records and the freelist, will be sto
20 red on the disk.  The disk consists of 256 blocks; each block ha
21 s 64 bytes.  We will use a simplified implementation of the NTFS
22  file system.  You might want to reread section 11.8, although w
23 e will not be implementing many of these features.  In our syste
24 m, each file will have a 64 bit Master File Record (MFR).  A blo
25 DL 4 .. 1 fff 26 jjj 3 kkk 10 
26 RB 360 27 6 
27 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
28 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
29 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
30 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
31 fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff fff 
32 fff fff fff fff fff fff fff fff fff fff 
33 ck can hold one of four structures:  A Master File Record} (one 
34 per file) This has an R (for regular file) in the first byte.  T
35 he second byte will hold either a B (for big) or an L (for littl
36 e).  The third and fourth bytes are a short int containing the n
37 umber of bytes in the file.  A little file is a file with less t
38 han 61 bytes and is stored completely in the MFR (NTFS does this
39 , although the sizes are different).  A big file is a file which
40  has 61 or more bytes and is stored in separate blocks.  To impl
41 ement a big file, you will use runs.  Each run consists of the s
42 tarting block and the number of contiguous blocks.  These should
43  be stored as consecutive pairs of short ints in the remainder o
44 f the MFR block.  There should be room for 15 pairs. 
45 RB 226 46 4 
46 bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb  bbb bbb bbb bbb bbb
47  bbb bbb bbb bbb bbb bbb  bbb bbb bbb bbb bbb bbb bbb bbb bbb bb
48 b bbb  bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb  bbb bbb bbb 
49 bbb bbb bbb bbb bbb bbb bbb bbb   
50 three three three three three three three three three three thre
51 e three three three three three three three three three 
65 This is kkk This is kkk This is kkk This is kkk This is kkk This
66  is kkk This is kkk This is kkk This is kkk This is kkk This is 
67 kkk This is kkk This is kkk This is kkk This is kkk This is kkk 
68 This is kkk This is kkk This is kkk This is kkk This is kkk This
69  is kkk This is kkk This is kkk This is kkk This is kkk This is 
70 kkk This is kkk  
83 The Tragedy of Hamlet, Prince of Denmark ACT I SCENE I. Elsinore
84 . A platform before the castle.      FRANCISCO at his post. Ente
85 r to him BERNARDO   BERNARDO      Who's there?  FRANCISCO      N
86 ay, answer me: stand, and unfold yourself.  BERNARDO      Long l
87 ive the king!  FRANCISCO      Bernardo?  BERNARDO      He.  FRAN
88 CISCO      You come most carefully upon your hour.  BERNARDO    
89   'Tis now struck twelve; get thee to bed, Francisco.  FRANCISCO
90       For this relief much thanks: 'tis bitter cold,     And I a
91 m sick at heart.  BERNARDO      Have you had quiet guard?  FRANC
92 ISCO      Not a mouse stirring.  BERNARDO      Well, good night.
93      If you do meet Horatio and Marcellus,     The rivals of my 
94 watch, bid them make haste.  FRANCISCO      I think I hear them.
95  Stand, ho! Who's there?      Enter HORATIO and MARCELLUS  HORAT
96 IO      Friends to this ground.  MARCELLUS      And liegemen to 
97 the Dane.  FRANCISCO      Give you good night. MARCELLUS      O,
98  farewell, honest soldier:     Who hath relieved you?  FRANCISCO
99       Bernardo has my place.     Give you good night.      Exit 
100  MARCELLUS      Holla! Bernardo!  BERNARDO      Say,     What, i
101 s Horatio there?  HORATIO      A piece of him.  BERNARDO      We
102 lcome, Horatio: welcome, good Marcellus.  MARCELLUS      What, h
103 as this thing appear'd again to-night?  BERNARDO      I have see
104 n nothing.  MARCELLUS      Horatio says 'tis but our fantasy,   
105   And will not let belief take hold of him     Touching this dre
106 aded sight, twice seen of us:     Therefore I have entreated him
107  along     With us to watch the minutes of this night;     That 
108 if again this apparition come,     He may approve our eyes and s
109 peak to it.  HORATIO      Tush, tush, 'twill not appear.