One of the flaws in Nachos is that you cannot expand a file in the Nachos File System. So this is what experiment 5 does.
We need to do the append and half append, both from UNIX file to Nachos file and from Nachos file to Nachos file.
Preparation
Copy filehdr , directory , filesys , Makefile , Makefile.local , openfile and synchdisk from filesys directory, and copy the arch directory of course, and did the same thing as experiment 2 : remove object files and bin files.
Makefile
Now we need to change the Makefile , only three lines :
ifndef MAKEFILE_LAB5 define MAKEFILE_LAB5 ## ........................... include ../lab5/Makefile.local
Now we could make file correctly, but there are also a few things to change:
main.cc
externvoidNAppend(char *nachosFileFrom, char *nachosFileTo, int half); // .................................................................... elseif (!strcmp(*argv, "-hnap")) { // cut half and append from Nachos to Nachos ASSERT(argc > 2); NAppend(*(argv + 1), *(argv + 2), 1); argCount = 3; }
So that we can use half append from Nachos file to Nachos file.
Read and modify Codes
We only need to focus on the append operation, so directly go to the major code part.
fstest.cc
Append
Append the contents of the UNIX file “from“ to the Nachos file “to“.
If “half“ is non-zero, start at the middle of file “to“ to appending the contents of “from”; Otherwise, do real appending after the end of file “to”.
If Nachos file “to” does not exist, create the nachos file “to” with length 0, then append the contents of UNIX file “from” to the end of it.
NAppend
NAppend is the same as Append except that the “from“ file is a Nachos file instead of a UNIX file. It appends the contents of Nachos file “from“ to the end of Nachos file “to“.
If Nachos file “to“ does not exist, create the nachos file “to“ with length 0, then append the contents of UNIX file “from“ to the end of it.
Append and NAppend are majorly the same, so we only need to compare the different part and also change parts of the same codes. The start position is defined by half : 0 to tail append, 1 to half append. And the data is collected in a buffer: buffer = new char[TransferSize]; . TransferSize is 10, the reading speed. And we see the reading process use openFile->Write(buffer, amountRead); . This is how it works. so dig into that.
Write() & WriteAt()
Write() is in openfile.cc , and it uses WriteAt(), so just focus on WriteAt() .
We see
if ((numBytes <= 0) || (position >= fileLength)) return0;
This is a restriction from appending files, so change it to :
if ((numBytes <= 0) || (position > fileLength)) // change here to make its end appendable return0;
The original code just cut the file length, instead of finding a new sector for the exceeded part, so change it:
if ((position + numBytes) > fileLength) { // which means it needs to be expanded int increaseBytes = position + numBytes - fileLength; // how long to increase BitMap *freeBitMap = fileSystem->getBitMap(); // fetch bitmap bool hdrResult; hdrResult = hdr->Allocate(freeBitMap, fileLength, increaseBytes); // modify header, bitmap if (!hdrResult) return0; fileSystem->setBitMap(freeBitMap); // update bitmap }
In order to get BitMap and set BitMap, we should add a few things to filesys :
Also, in the last step we changed file header by using Allocate , which is in filehdr.cc :
FileHeader::Allocate
Initialize a fresh file header for a newly created file. Allocate data blocks for the file out of the map of free disk blocks. Return FALSE if there are not enough free blocks to accommodate the new file.
“freeMap“ is the bit map of free disk sectors “fileSize“ is the bit map of free disk sectors
The original Allocate is only made for creating a new file, so we need to change it to make it available for appending files. Below is the code:
boolFileHeader::Allocate(BitMap *freeMap, int fileSize, int incrementBytes){ if (numSectors > NumDirect) returnfalse; // append in a blank file if ((fileSize == 0) && (incrementBytes > 0)) { if (freeMap->NumClear() < 1) { // no enough space printf("Insufficient Disk Space.\n"); returnfalse; } dataSectors[0] = freeMap->Find(); // find a free space numSectors = 1; numBytes = 0; } numBytes = fileSize; int offset = numSectors * SectorSize - numBytes; // the last sector offset to full in the original file int newSectorBytes = incrementBytes - offset; // new sector takes if (newSectorBytes <= 0) { // just put in the original sector (enough) numBytes = numBytes + incrementBytes; returntrue; } // original sector not enough, need to expand int moreSectors = divRoundUp(newSectorBytes, SectorSize); if (numSectors + moreSectors > NumDirect) returnfalse; if (freeMap->NumClear() < moreSectors) { // no enough space to use printf("Insufficient Disk Space.\n"); returnfalse; } for (int i = numSectors; i < numSectors + moreSectors; i++) dataSectors[i] = freeMap->Find(); numBytes = numBytes + incrementBytes; numSectors = numSectors + moreSectors; return TRUE; }
The NumDirect is the number of free sector in the whole file system:
There are too many things to do, so I write 4 shell files:
############# 1.sh ############# ## test append rm DISK ./nachos -f ./nachos -cp test/small small hexdump -C DISK ./nachos -ap test/small small hexdump -C DISK ./nachos -cp test/empty empty hexdump -C DISK ./nachos -ap test/medium empty hexdump -C DISK ./nachos -D ############# 2.sh ############# ## test half append rm DISK ./nachos -f ./nachos -cp test/small small ./nachos -cp test/big big hexdump -C DISK ./nachos -hap test/small big ./nachos -hap test/big small hexdump -C DISK ./nachos -D ############# 3.sh ############# ## test nachos append rm DISK ./nachos -f ./nachos -cp test/medium medium ./nachos -cp test/big big hexdump -C DISK ./nachos -nap medium big hexdump -C DISK ./nachos -D ############# 4.sh ############# ## test half N-append rm DISK ./nachos -f ./nachos -cp test/medium medium ./nachos -cp test/big big hexdump -C DISK ./nachos -hnap medium big hexdump -C DISK ./nachos -D
No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting!
Ticks: total 7430, idle 7000, system 430, user 0 Disk I/O: reads 14, writes 0 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0
Cleaning up...
Copy empty, append small to small and append medium to empty works fine.
half-append
root@iZbp1iqmvkj69470qn1vpvZ:~/OS/lab5# ./002.sh No threads ready or runnable, and no pending interrupts. ........................................... Cleaning up... No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting!
Ticks: total 597520, idle 595020, system 2500, user 0 Disk I/O: reads 44, writes 39 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0
Ticks: total 84020, idle 83590, system 430, user 0 Disk I/O: reads 9, writes 5 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0
Cleaning up... No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting!
Ticks: total 563020, idle 558870, system 4150, user 0 Disk I/O: reads 71, writes 67 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0
Cleaning up... 00000000 ab 89 67 45 80 00 00 00 01 00 00 00 02 00 00 00 |..gE............| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000080 00 00 00 00 c8 00 00 00 02 00 00 00 03 00 00 00 |................| 00000090 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 000000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000100 00 00 00 00 ff 1f 00 00 00 00 00 00 00 00 00 00 |................| 00000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000180 00 00 00 00 01 00 00 00 05 00 00 00 73 6d 61 6c |............smal| 00000190 6c 00 00 00 00 00 00 00 01 00 00 00 07 00 00 00 |l...............| 000001a0 62 69 67 00 00 00 00 00 00 00 00 00 00 00 00 00 |big.............| 000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000280 00 00 00 00 56 01 00 00 03 00 00 00 06 00 00 00 |....V...........| 00000290 0b 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00 |................| 000002a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000300 00 00 00 00 54 68 69 73 20 69 73 20 61 20 73 6d |....This is a sm| 00000310 61 6c 6c 20 66 69 6c 65 54 68 69 73 20 69 73 20 |all fileThis is | 00000320 61 20 62 69 67 20 66 69 6c 65 0a 54 68 69 73 20 |a big file.This | 00000330 69 73 20 61 20 62 69 67 20 66 69 6c 65 0a 54 68 |is a big file.Th| 00000340 69 73 20 69 73 20 61 20 62 69 67 20 66 69 6c 65 |is is a big file| 00000350 0a 54 68 69 73 20 69 73 20 61 20 62 69 67 20 66 |.This is a big f| 00000360 69 6c 65 0a 54 68 69 73 20 69 73 20 61 20 62 69 |ile.This is a bi| 00000370 67 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 |g file.This is a| 00000380 20 62 69 67 42 01 00 00 03 00 00 00 08 00 00 00 | bigB...........| 00000390 09 00 00 00 0a 00 00 00 00 00 00 00 00 00 00 00 |................| 000003a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000400 00 00 00 00 54 68 69 73 20 69 73 20 61 20 62 69 |....This is a bi| 00000410 67 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 |g file.This is a| 00000420 20 62 69 67 20 66 69 6c 65 0a 54 68 69 73 20 69 | big file.This i| 00000430 73 20 61 20 62 69 67 20 66 69 6c 65 0a 54 68 69 |s a big file.Thi| 00000440 73 20 69 73 20 61 20 62 69 67 20 66 69 6c 65 0a |s is a big file.| 00000450 54 68 69 73 20 69 73 20 61 20 62 69 67 20 66 69 |This is a big fi| 00000460 6c 65 0a 54 68 69 73 20 69 73 20 61 20 62 69 67 |le.This is a big| 00000470 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 20 | file.This is a | 00000480 62 69 67 20 66 69 6c 65 0a 54 68 69 73 20 69 73 |big file.This is| 00000490 20 61 20 62 69 67 20 66 69 6c 65 0a 54 68 69 73 | a big file.This| 000004a0 20 69 73 20 61 54 68 69 73 20 69 73 20 61 20 73 | is aThis is a s| 000004b0 6d 61 6c 6c 20 66 69 6c 65 2e 0a 2a 2a 2a 65 6e |mall file..***en| 000004c0 64 20 6f 66 20 66 69 6c 65 2a 2a 2a 0a 69 67 20 |d of file***.ig | 000004d0 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 20 62 |file.This is a b| 000004e0 69 67 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 |ig file.This is | 000004f0 61 20 62 69 67 20 66 69 6c 65 0a 54 68 69 73 20 |a big file.This | 00000500 69 73 20 61 20 62 69 67 20 66 69 6c 65 0a 54 68 |is a big file.Th| 00000510 69 73 20 69 73 20 61 20 62 69 67 20 66 69 6c 65 |is is a big file| 00000520 0a 54 68 69 73 20 69 73 20 61 20 62 69 67 20 66 |.This is a big f| 00000530 69 6c 65 0a 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 |ile.***end of fi| 00000540 6c 65 2a 2a 2a 0a 00 00 00 00 00 00 00 00 00 00 |le***...........| 00000550 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000580 00 00 00 00 20 66 69 6c 65 0a 54 68 69 73 20 69 |.... file.This i| 00000590 73 20 61 20 62 69 67 20 66 69 6c 65 0a 54 68 69 |s a big file.Thi| 000005a0 73 20 69 73 20 61 20 62 69 67 20 66 69 6c 65 0a |s is a big file.| 000005b0 54 68 69 73 20 69 73 20 61 20 62 69 67 20 66 69 |This is a big fi| 000005c0 6c 65 0a 54 68 69 73 20 69 73 20 61 20 62 69 67 |le.This is a big| 000005d0 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 20 | file.This is a | 000005e0 62 69 67 20 66 69 6c 65 0a 54 68 69 73 20 69 73 |big file.This is| 000005f0 20 61 20 62 69 67 20 66 69 6c 65 0a 54 68 69 73 | a big file.This| 00000600 20 69 73 20 61 20 62 69 67 20 66 69 6c 65 0a 54 | is a big file.T| 00000610 68 69 73 20 69 73 20 61 20 62 69 67 20 66 69 6c |his is a big fil| 00000620 65 0a 54 68 69 73 20 69 73 20 61 20 62 69 67 20 |e.This is a big | 00000630 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 20 62 |file.This is a b| 00000640 69 67 20 66 69 6c 65 0a 2a 2a 2a 65 6e 64 20 6f |ig file.***end o| 00000650 66 20 66 69 6c 65 2a 2a 2a 0a 00 00 00 00 00 00 |f file***.......| 00000660 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00020004 Bit map file header: FileHeader contents. File size: 128. File blocks: 2 File contents: \ff\1f\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 Directory file header: FileHeader contents. File size: 200. File blocks: 3 4 File contents: \1\0\0\0\5\0\0\0small\0\0\0\0\0\0\0\1\0\0\0\7\0\0\0big\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 Bitmap set: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, Directory contents: Name: small, Sector: 5 FileHeader contents. File size: 342. File blocks: 6 11 12 File contents: This is a small fileThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\a***end of file***\a Name: big, Sector: 7 FileHeader contents. File size: 322. File blocks: 8 9 10 File contents: This is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is aThis is a small file.\a***end of file***\aig file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\a***end of file***\a
No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting!
Ticks: total 9550, idle 9000, system 550, user 0 Disk I/O: reads 18, writes 0 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0
Cleaning up...
Half append big to small and small to big works fine.
nachos-append
root@iZbp1iqmvkj69470qn1vpvZ:~/OS/lab5# ./003.sh No threads ready or runnable, and no pending interrupts. .................................... Cleaning up... No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting!
Ticks: total 597520, idle 595020, system 2500, user 0 Disk I/O: reads 44, writes 39 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0
Ticks: total 244020, idle 241730, system 2290, user 0 Disk I/O: reads 48, writes 28 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0
Cleaning up... 00000000 ab 89 67 45 80 00 00 00 01 00 00 00 02 00 00 00 |..gE............| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000080 00 00 00 00 c8 00 00 00 02 00 00 00 03 00 00 00 |................| 00000090 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 000000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000100 00 00 00 00 ff 0f 00 00 00 00 00 00 00 00 00 00 |................| 00000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000180 00 00 00 00 01 00 00 00 05 00 00 00 6d 65 64 69 |............medi| 00000190 75 6d 00 00 00 00 00 00 01 00 00 00 07 00 00 00 |um..............| 000001a0 62 69 67 00 00 00 00 00 00 00 00 00 00 00 00 00 |big.............| 000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000280 00 00 00 00 80 00 00 00 01 00 00 00 06 00 00 00 |................| 00000290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000300 00 00 00 00 54 68 69 73 20 69 73 20 61 20 6d 65 |....This is a me| 00000310 64 69 75 6d 20 66 69 6c 65 0a 54 68 69 73 20 69 |dium file.This i| 00000320 73 20 61 20 6d 65 64 69 75 6d 20 66 69 6c 65 0a |s a medium file.| 00000330 54 68 69 73 20 69 73 20 61 20 6d 65 64 69 75 6d |This is a medium| 00000340 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 20 | file.This is a | 00000350 6d 65 64 69 75 6d 20 66 69 6c 65 0a 54 68 69 73 |medium file.This| 00000360 20 69 73 20 61 20 6d 65 64 69 75 6d 20 66 69 6c | is a medium fil| 00000370 65 0a 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 6c 65 |e.***end of file| 00000380 2a 2a 2a 0a c2 01 00 00 04 00 00 00 08 00 00 00 |***.............| 00000390 09 00 00 00 0a 00 00 00 0b 00 00 00 00 00 00 00 |................| 000003a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000400 00 00 00 00 54 68 69 73 20 69 73 20 61 20 62 69 |....This is a bi| 00000410 67 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 |g file.This is a| 00000420 20 62 69 67 20 66 69 6c 65 0a 54 68 69 73 20 69 | big file.This i| 00000430 73 20 61 20 62 69 67 20 66 69 6c 65 0a 54 68 69 |s a big file.Thi| 00000440 73 20 69 73 20 61 20 62 69 67 20 66 69 6c 65 0a |s is a big file.| 00000450 54 68 69 73 20 69 73 20 61 20 62 69 67 20 66 69 |This is a big fi| 00000460 6c 65 0a 54 68 69 73 20 69 73 20 61 20 62 69 67 |le.This is a big| 00000470 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 20 | file.This is a | 00000480 62 69 67 20 66 69 6c 65 0a 54 68 69 73 20 69 73 |big file.This is| 00000490 20 61 20 62 69 67 20 66 69 6c 65 0a 54 68 69 73 | a big file.This| 000004a0 20 69 73 20 61 20 62 69 67 20 66 69 6c 65 0a 54 | is a big file.T| 000004b0 68 69 73 20 69 73 20 61 20 62 69 67 20 66 69 6c |his is a big fil| 000004c0 65 0a 54 68 69 73 20 69 73 20 61 20 62 69 67 20 |e.This is a big | 000004d0 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 20 62 |file.This is a b| 000004e0 69 67 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 |ig file.This is | 000004f0 61 20 62 69 67 20 66 69 6c 65 0a 54 68 69 73 20 |a big file.This | 00000500 69 73 20 61 20 62 69 67 20 66 69 6c 65 0a 54 68 |is a big file.Th| 00000510 69 73 20 69 73 20 61 20 62 69 67 20 66 69 6c 65 |is is a big file| 00000520 0a 54 68 69 73 20 69 73 20 61 20 62 69 67 20 66 |.This is a big f| 00000530 69 6c 65 0a 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 |ile.***end of fi| 00000540 6c 65 2a 2a 2a 0a 54 68 69 73 20 69 73 20 61 20 |le***.This is a | 00000550 6d 65 64 69 75 6d 20 66 69 6c 65 0a 54 68 69 73 |medium file.This| 00000560 20 69 73 20 61 20 6d 65 64 69 75 6d 20 66 69 6c | is a medium fil| 00000570 65 0a 54 68 69 73 20 69 73 20 61 20 6d 65 64 69 |e.This is a medi| 00000580 75 6d 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 |um file.This is | 00000590 61 20 6d 65 64 69 75 6d 20 66 69 6c 65 0a 54 68 |a medium file.Th| 000005a0 69 73 20 69 73 20 61 20 6d 65 64 69 75 6d 20 66 |is is a medium f| 000005b0 69 6c 65 0a 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 |ile.***end of fi| 000005c0 6c 65 2a 2a 2a 0a 00 00 00 00 00 00 00 00 00 00 |le***...........| 000005d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00020004 Bit map file header: FileHeader contents. File size: 128. File blocks: 2 File contents: \ff\f\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 Directory file header: FileHeader contents. File size: 200. File blocks: 3 4 File contents: \1\0\0\0\5\0\0\0medium\0\0\0\0\0\0\1\0\0\0\7\0\0\0big\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 Bitmap set: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, Directory contents: Name: medium, Sector: 5 FileHeader contents. File size: 128. File blocks: 6 File contents: This is a medium file\aThis is a medium file\aThis is a medium file\aThis is a medium file\aThis is a medium file\a***end of file***\a Name: big, Sector: 7 FileHeader contents. File size: 450. File blocks: 8 9 10 11 File contents: This is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\aThis is a big file\a***end of file***\aThis is a medium file\aThis is a medium file\aThis is a medium f ile\aThis is a medium file\aThis is a medium file\a***end of file***\a
No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting!
Ticks: total 9020, idle 8500, system 520, user 0 Disk I/O: reads 17, writes 0 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0
Cleaning up...
Also fine.
half-nachos-append
root@iZbp1iqmvkj69470qn1vpvZ:~/OS/lab5# ./004.sh No threads ready or runnable, and no pending interrupts. ..................................... Cleaning up... No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting!
Ticks: total 597520, idle 595020, system 2500, user 0 Disk I/O: reads 44, writes 39 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0