0%

Append() in Nachos FIle System

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

And the Makefile.local :

ifndef MAKEFILE_LAB5_LOCAL
define MAKEFILE_LAB5_LOCAL
yes
endef

# Add new sourcefiles here.

CCFILES +=main.cc\
bitmap.cc\
directory.cc\
filehdr.cc\
filesys.cc\
fstest.cc\
openfile.cc\
synchdisk.cc\
disk.cc

ifdef MAKEFILE_USERPROG_LOCAL
DEFINES := $(DEFINES:FILESYS_STUB=FILESYS)
else
INCPATH += -I../lab5 -I../userprog
DEFINES += -DFILESYS_NEEDED -DFILESYS
endif

endif # MAKEFILE_LAB5_LOCAL

Now we could make file correctly, but there are also a few things to change:

main.cc

extern void NAppend(char *nachosFileFrom, char *nachosFileTo, int half);
// ....................................................................
else if (!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))
return 0;

This is a restriction from appending files, so change it to :

if ((numBytes <= 0) || (position > fileLength)) // change here to make its end appendable
return 0;

And

if ((position + numBytes) > fileLength)
numBytes = fileLength - position;

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)
return 0;
fileSystem->setBitMap(freeBitMap); // update bitmap
}

In order to get BitMap and set BitMap, we should add a few things to filesys :

BitMap* FileSystem::getBitMap() {
BitMap *freeBitMap = new BitMap(NumSectors);
freeBitMap->FetchFrom(freeMapFile);
return freeBitMap;
}

void FileSystem::setBitMap(BitMap* freeMap) {
freeMap->WriteBack(freeMapFile);
}

Don’t forget to declare that in filesys.h .

filehdr.cc

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:

bool FileHeader::Allocate(BitMap *freeMap, int fileSize, int incrementBytes) {
if (numSectors > NumDirect) return false;
// append in a blank file
if ((fileSize == 0) && (incrementBytes > 0)) {
if (freeMap->NumClear() < 1) { // no enough space
printf("Insufficient Disk Space.\n");
return false;
}
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;
return true;
}
// original sector not enough, need to expand
int moreSectors = divRoundUp(newSectorBytes, SectorSize);
if (numSectors + moreSectors > NumDirect)
return false;
if (freeMap->NumClear() < moreSectors) { // no enough space to use
printf("Insufficient Disk Space.\n");
return false;
}
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:

#define NumDirect 	((SectorSize - 2 * sizeof(int)) / sizeof(int))

The SectorSize is 128 , Think of the structure of the file header, the first 2 is used for 2 integers, so the left is

$(128-2\times4)\div4=30$ . Only 30 sectors available at most.

So if it asks too much, there is no space for it, return FALSE.

The following lines calculate how many sectors it should take:

If the last sector of the original file is big enough to contain the increasement, no extra sectors are needed. If not, find sectors for them.

openfile.cc

The last thing is write back. so enable the codes in fstest.cc :

openFile->WriteBack();
DEBUG('f',"inodes have been written back\n");

And modify openfile.cc :

OpenFile::OpenFile(int sector) { 
hdr = new FileHeader;
hdr->FetchFrom(sector);
seekPosition = 0;
hdrSector = sector;
}
// .............................
void OpenFile::WriteBack() {
hdr->WriteBack(hdrSector);
}

All is done.

Run and Test

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

Testing append, half-append, nachos-append, half-nachos-append.

Below is the result:

append

root@iZbp1iqmvkj69470qn1vpvZ:~/OS/lab5# ./001.sh
No threads ready or runnable, and no pending interrupts.
....................................
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 7f 00 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 00 00 00 00 00 00 00 00 |l...............|
000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000280 00 00 00 00 28 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 73 6d |....This is a sm|
00000310 61 6c 6c 20 66 69 6c 65 2e 0a 2a 2a 2a 65 6e 64 |all file..***end|
00000320 20 6f 66 20 66 69 6c 65 2a 2a 2a 0a 00 00 00 00 | of file***.....|
00000330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00020004
No threads ready or runnable, and no pending interrupts.
Assuming the program completed.
Machine halting!

Ticks: total 83020, idle 82350, system 670, user 0
Disk I/O: reads 13, writes 9
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 7f 00 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 00 00 00 00 00 00 00 00 |l...............|
000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000280 00 00 00 00 50 00 00 00 01 00 00 00 06 00 00 00 |....P...........|
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 73 6d |....This is a sm|
00000310 61 6c 6c 20 66 69 6c 65 2e 0a 2a 2a 2a 65 6e 64 |all file..***end|
00000320 20 6f 66 20 66 69 6c 65 2a 2a 2a 0a 54 68 69 73 | of file***.This|
00000330 20 69 73 20 61 20 73 6d 61 6c 6c 20 66 69 6c 65 | is a small file|
00000340 2e 0a 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 6c 65 |..***end of file|
00000350 2a 2a 2a 0a 00 00 00 00 00 00 00 00 00 00 00 00 |***.............|
00000360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00020004
No threads ready or runnable, and no pending interrupts.
Assuming the program completed.
Machine halting!

Ticks: total 51110, idle 50710, system 400, user 0
Disk I/O: reads 9, writes 4
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 00 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 65 6d 70 74 79 00 00 00 00 00 00 00 00 00 00 00 |empty...........|
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000280 00 00 00 00 50 00 00 00 01 00 00 00 06 00 00 00 |....P...........|
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 73 6d |....This is a sm|
00000310 61 6c 6c 20 66 69 6c 65 2e 0a 2a 2a 2a 65 6e 64 |all file..***end|
00000320 20 6f 66 20 66 69 6c 65 2a 2a 2a 0a 54 68 69 73 | of file***.This|
00000330 20 69 73 20 61 20 73 6d 61 6c 6c 20 66 69 6c 65 | is a small file|
00000340 2e 0a 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 6c 65 |..***end of file|
00000350 2a 2a 2a 0a 00 00 00 00 00 00 00 00 00 00 00 00 |***.............|
00000360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00020004
No threads ready or runnable, and no pending interrupts.
Assuming the program completed.
Machine halting!

Ticks: total 228020, idle 226270, system 1750, user 0
Disk I/O: reads 31, writes 27
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 01 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 65 6d 70 74 79 00 00 00 00 00 00 00 00 00 00 00 |empty...........|
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000280 00 00 00 00 50 00 00 00 01 00 00 00 06 00 00 00 |....P...........|
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 73 6d |....This is a sm|
00000310 61 6c 6c 20 66 69 6c 65 2e 0a 2a 2a 2a 65 6e 64 |all file..***end|
00000320 20 6f 66 20 66 69 6c 65 2a 2a 2a 0a 54 68 69 73 | of file***.This|
00000330 20 69 73 20 61 20 73 6d 61 6c 6c 20 66 69 6c 65 | is a small file|
00000340 2e 0a 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 6c 65 |..***end of file|
00000350 2a 2a 2a 0a 00 00 00 00 00 00 00 00 00 00 00 00 |***.............|
00000360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000380 00 00 00 00 80 00 00 00 01 00 00 00 08 00 00 00 |................|
00000390 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 6d 65 |....This is a me|
00000410 64 69 75 6d 20 66 69 6c 65 0a 54 68 69 73 20 69 |dium file.This i|
00000420 73 20 61 20 6d 65 64 69 75 6d 20 66 69 6c 65 0a |s a medium file.|
00000430 54 68 69 73 20 69 73 20 61 20 6d 65 64 69 75 6d |This is a medium|
00000440 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 20 | file.This is a |
00000450 6d 65 64 69 75 6d 20 66 69 6c 65 0a 54 68 69 73 |medium file.This|
00000460 20 69 73 20 61 20 6d 65 64 69 75 6d 20 66 69 6c | is a medium fil|
00000470 65 0a 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 6c 65 |e.***end of file|
00000480 2a 2a 2a 0a 00 00 00 00 00 00 00 00 00 00 00 00 |***.............|
00000490 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\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\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\0empty\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\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,
Directory contents:
Name: small, Sector: 5
FileHeader contents. File size: 80. File blocks:
6
File contents:
This is a small file.\a***end of file***\aThis is a small file.\a***end of file***\a
Name: empty, Sector: 7
FileHeader contents. File size: 128. File blocks:
8
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

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

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 07 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 28 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 73 6d |....This is a sm|
00000310 61 6c 6c 20 66 69 6c 65 2e 0a 2a 2a 2a 65 6e 64 |all file..***end|
00000320 20 6f 66 20 66 69 6c 65 2a 2a 2a 0a 00 00 00 00 | of file***.....|
00000330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000380 00 00 00 00 42 01 00 00 03 00 00 00 08 00 00 00 |....B...........|
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 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 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 |................|
*
00020004
No threads ready or runnable, and no pending interrupts.
Assuming the program completed.
Machine halting!

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

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 07 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 42 01 00 00 03 00 00 00 08 00 00 00 |***.B...........|
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 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 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 |................|
*
00020004
No threads ready or runnable, and no pending interrupts.
Assuming the program completed.
Machine halting!

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

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 07 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 42 01 00 00 03 00 00 00 08 00 00 00 |***.B...........|
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 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 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 |................|
*
00020004
No threads ready or runnable, and no pending interrupts.
Assuming the program completed.
Machine halting!

Ticks: total 244020, idle 242510, system 1510, user 0
Disk I/O: reads 35, writes 15
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 07 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 42 01 00 00 03 00 00 00 08 00 00 00 |***.B...........|
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 6d | is aThis is a m|
000004b0 65 64 69 75 6d 20 66 69 6c 65 0a 54 68 69 73 20 |edium file.This |
000004c0 69 73 20 61 20 6d 65 64 69 75 6d 20 66 69 6c 65 |is a medium file|
000004d0 0a 54 68 69 73 20 69 73 20 61 20 6d 65 64 69 75 |.This is a mediu|
000004e0 6d 20 66 69 6c 65 0a 54 68 69 73 20 69 73 20 61 |m file.This is a|
000004f0 20 6d 65 64 69 75 6d 20 66 69 6c 65 0a 54 68 69 | medium file.Thi|
00000500 73 20 69 73 20 61 20 6d 65 64 69 75 6d 20 66 69 |s is a medium fi|
00000510 6c 65 0a 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 6c |le.***end of fil|
00000520 65 2a 2a 2a 0a 20 69 73 20 61 20 62 69 67 20 66 |e***. 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 2a 2a 2a 65 6e 64 20 6f 66 20 66 69 6c 65 |e.***end of file|
00000580 2a 2a 2a 0a 00 00 00 00 00 00 00 00 00 00 00 00 |***.............|
00000590 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\7\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\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,
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: 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 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 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 8490, idle 8000, system 490, user 0
Disk I/O: reads 16, writes 0
Console I/O: reads 0, writes 0
Paging: faults 0
Network I/O: packets received 0, sent 0

Cleaning up...

Fine.