-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10ef943
commit ae5c2c0
Showing
178 changed files
with
12,868 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Assignment 2 | ||
## CS1217 Operating Systems (Spring 2023) | ||
--- | ||
|
||
### Setting up Git on your Virtual Machines | ||
|
||
You will need a Unix environment for this (MacOS, or Linux). | ||
|
||
Follow the sections **Generating a new SSH key** and **Adding your SSH key to the ssh-agent** from [this link](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent), and then follow the section **Adding a new SSH key to your account** from [this link](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account). | ||
|
||
Make sure that you do this with the same GitHub Account that you're using to access the assignment. | ||
|
||
Finally, you will have to take one last step. Execute the following command on your Terminal (copy-paste this, because the placements of the apostrophes are important): | ||
|
||
``` | ||
echo "Host github.com | ||
Hostname ssh.github.com | ||
Port 443" >> ~/.ssh/config | ||
``` | ||
|
||
### Cloning this Repository | ||
|
||
1. There will be a big green button saying *Code* at the top of the page. Click that, click on *Local* and then click on *SSH*. Copy the link that is shown there (it should start with something like ```git@github.com:...```). | ||
2. Open a Terminal on your VM, and run the command ```git clone [SSH URL]``` where ```[SSH URL]``` is what you copied in Step 1. | ||
3. Run ```ls```, and you will be able to see the name of the directory that the repository got cloned to. | ||
4. Run ```cd [DIRECTORY NAME]``` where ```[DIRECTORY NAME]``` is the name of the repository directory that you saw in Step 3. | ||
|
||
Those are all the cloned files. If you're using a Desktop Version of Ubuntu, you will be able to find this cloned folder in your Home directory. Use these files during the assignment. |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <unistd.h> | ||
#include <stdio.h> | ||
#include <sys/time.h> | ||
|
||
int main(int argc, char *argv[]) | ||
|
||
{ | ||
unsigned int i; | ||
int count = 0; | ||
struct timeval tv; | ||
|
||
while(1) | ||
{ | ||
for(i = 0; i < 1000000; i++) | ||
{ | ||
gettimeofday(&tv, NULL); | ||
printf("%u sec, %u usec\n", tv.tv_sec, tv.tv_usec); | ||
} | ||
count++; | ||
printf("round %d complete\n", count); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <unistd.h> | ||
#include <stdio.h> | ||
|
||
int main(int argc, char *argv[]) | ||
|
||
{ | ||
unsigned int i,j; | ||
while(1) | ||
{ | ||
j = 1; | ||
for(i = 1; i <= 10; i++) | ||
{ | ||
j = j*i; | ||
} | ||
} | ||
} | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <unistd.h> | ||
#include <stdio.h> | ||
#include<stdlib.h> | ||
#include <sys/types.h> | ||
#include <string.h> | ||
#include <errno.h> | ||
|
||
#define FNAME_SIZE 100 | ||
#define MAX_FILE_NO 10000 | ||
#define BLOCK_SIZE 1024 | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
|
||
int n, file_no; | ||
FILE *fp; | ||
char dest_file_name[FNAME_SIZE]; | ||
char buf[BLOCK_SIZE]; | ||
|
||
while(1) | ||
{ | ||
file_no = rand() % MAX_FILE_NO; | ||
|
||
bzero(dest_file_name, FNAME_SIZE); | ||
sprintf(dest_file_name, "files/foo%d.txt", file_no); | ||
|
||
fp = fopen(dest_file_name, "rb"); | ||
if (fp == NULL) { | ||
perror("Can't open dest file"); | ||
exit(1); | ||
} | ||
|
||
bzero(buf,BLOCK_SIZE); | ||
while ( (n = (int)fread( buf, 1, BLOCK_SIZE, fp )) > 0) | ||
{ | ||
//do nothing with the read data; | ||
bzero(buf,BLOCK_SIZE); | ||
} | ||
|
||
fclose(fp); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include <unistd.h> | ||
#include <stdio.h> | ||
#include <sys/types.h> | ||
#include <string.h> | ||
#include <errno.h> | ||
#include<stdlib.h> | ||
|
||
#define FNAME_SIZE 100 | ||
#define MAX_FILE_NO 10000 | ||
#define BLOCK_SIZE 1024 | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
|
||
int n, file_no; | ||
FILE *fp; | ||
char dest_file_name[FNAME_SIZE]; | ||
char buf[BLOCK_SIZE]; | ||
|
||
while(1) | ||
{ | ||
//file_no = rand() % MAX_FILE_NO; | ||
file_no = 0; | ||
|
||
bzero(dest_file_name, FNAME_SIZE); | ||
sprintf(dest_file_name, "files/foo%d.txt", file_no); | ||
|
||
fp = fopen(dest_file_name, "rb"); | ||
if (fp == NULL) { | ||
perror("Can't open dest file"); | ||
exit(1); | ||
} | ||
|
||
bzero(buf,BLOCK_SIZE); | ||
while ( (n = (int)fread( buf, 1, BLOCK_SIZE, fp )) > 0) | ||
{ | ||
//do nothing with the read data; | ||
bzero(buf,BLOCK_SIZE); | ||
} | ||
|
||
fclose(fp); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import os | ||
for i in range(10000): | ||
file_name = f"foo{i}.txt" | ||
file_size = 2*1024*1024 #size in Bytes | ||
with open(file_name, "wb") as f: | ||
f.write(os.urandom(file_size)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*.asm | ||
*.d | ||
*.sym | ||
_* | ||
kernel | ||
user1 | ||
userfs | ||
usertests | ||
xv6.img | ||
vectors.S | ||
bochsout.txt | ||
bootblock | ||
bootother | ||
bootother.out | ||
parport.out | ||
fmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
((c-mode | ||
(indent-tabs-mode . nil) | ||
(c-file-style . "bsd") | ||
(c-basic-offset . 2))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
set $lastcs = -1 | ||
|
||
define hook-stop | ||
# There doesn't seem to be a good way to detect if we're in 16- or | ||
# 32-bit mode, but in 32-bit mode we always run with CS == 8 in the | ||
# kernel and CS == 35 in user space | ||
if $cs == 8 || $cs == 35 | ||
if $lastcs != 8 && $lastcs != 35 | ||
set architecture i386 | ||
end | ||
x/i $pc | ||
else | ||
if $lastcs == -1 || $lastcs == 8 || $lastcs == 35 | ||
set architecture i8086 | ||
end | ||
# Translate the segment:offset into a physical address | ||
printf "[%4x:%4x] ", $cs, $eip | ||
x/i $cs*16+$eip | ||
end | ||
set $lastcs = $cs | ||
end | ||
|
||
echo + target remote localhost:26000\n | ||
target remote localhost:26000 | ||
|
||
echo + symbol-file kernel\n | ||
symbol-file kernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
set $lastcs = -1 | ||
|
||
define hook-stop | ||
# There doesn't seem to be a good way to detect if we're in 16- or | ||
# 32-bit mode, but in 32-bit mode we always run with CS == 8 in the | ||
# kernel and CS == 35 in user space | ||
if $cs == 8 || $cs == 35 | ||
if $lastcs != 8 && $lastcs != 35 | ||
set architecture i386 | ||
end | ||
x/i $pc | ||
else | ||
if $lastcs == -1 || $lastcs == 8 || $lastcs == 35 | ||
set architecture i8086 | ||
end | ||
# Translate the segment:offset into a physical address | ||
printf "[%4x:%4x] ", $cs, $eip | ||
x/i $cs*16+$eip | ||
end | ||
set $lastcs = $cs | ||
end | ||
|
||
echo + target remote localhost:1234\n | ||
target remote localhost:1234 | ||
|
||
echo + symbol-file kernel\n | ||
symbol-file kernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
*.asm | ||
*.d | ||
*.sym | ||
_* | ||
############## | ||
# *.img | ||
# *.out | ||
# *.o | ||
# mkfs | ||
# entryother | ||
# initcode | ||
############## | ||
kernel | ||
user1 | ||
userfs | ||
usertests | ||
xv6.img | ||
vectors.S | ||
bochsout.txt | ||
bootblock | ||
bootother | ||
bootother.out | ||
parport.out | ||
fmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
formatting: | ||
need to fix PAGEBREAK mechanism | ||
|
||
sh: | ||
can't always runcmd in child -- breaks cd. | ||
maybe should hard-code PATH=/ ? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
The xv6 software is: | ||
|
||
Copyright (c) 2006-2018 Frans Kaashoek, Robert Morris, Russ Cox, | ||
Massachusetts Institute of Technology | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
Oops, something went wrong.