PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
Go to the source code of this file.
Macros | |
#define | CHUNK_SIZE (126 * 512) |
Generates about 1 MB of random data that is then divided into 16 chunks. More... | |
#define | CHUNK_CNT 16 |
Number of chunks. More... | |
#define | DATA_SIZE (CHUNK_CNT * CHUNK_SIZE) |
Buffer size. More... | |
Functions | |
static void | init (void) |
Initialize buf1 with random data, then count the number of instances of each value within it. More... | |
static void | sort_chunks (void) |
Sort each chunk of buf1 using a subprocess. More... | |
static void | merge (void) |
Merge the sorted chunks in buf1 into a fully sorted buf2. More... | |
static void | verify (void) |
void | test_main (void) |
tests/main.h More... | |
Variables | |
unsigned char | buf1 [DATA_SIZE] |
unsigned char | buf2 [DATA_SIZE] |
size_t | histogram [256] |
#define CHUNK_CNT 16 |
Number of chunks.
Definition at line 15 of file page-merge-seq.c.
#define CHUNK_SIZE (126 * 512) |
Generates about 1 MB of random data that is then divided into 16 chunks.
A separate subprocess sorts each chunk in sequence. Then we merge the chunks and verify that the result is what it should be. This is the max file size for an older version of the Pintos file system that had 126 direct blocks each pointing to a single disk sector. We could raise it now.
Definition at line 14 of file page-merge-seq.c.
#define DATA_SIZE (CHUNK_CNT * CHUNK_SIZE) |
Buffer size.
Definition at line 16 of file page-merge-seq.c.
|
static |
Initialize buf1 with random data, then count the number of instances of each value within it.
Definition at line 24 of file page-merge-seq.c.
References arc4_crypt(), arc4_init(), buf1, histogram, arc4::i, and msg().
Referenced by test_main().
|
static |
Merge the sorted chunks in buf1 into a fully sorted buf2.
Definition at line 73 of file page-merge-seq.c.
References buf1, buf2, CHUNK_CNT, CHUNK_SIZE, arc4::i, and msg().
Referenced by test_main().
|
static |
Sort each chunk of buf1 using a subprocess.
Definition at line 39 of file page-merge-seq.c.
References buf1, CHECK, CHUNK_CNT, CHUNK_SIZE, close(), create(), exec(), arc4::i, msg(), open(), quiet, read(), wait(), and write().
Referenced by test_main().
void test_main | ( | void | ) |
This must fail, because that directory is non-empty.
This must fail.
Then delete most of them, for two reasons. First, "tar" limits file names to 100 characters (which could be extended to 256 without much trouble). Second, a full disk has no room for the tar archive.
This should terminate the process with a -1 exit code.
Sets the stack pointer (esp) to an invalid value and invokes a system call, which should then terminate the process with a -1 exit code.
The second close must either fail silently or terminate with exit code -1.
This is valid, so it must succeed.
The process must be terminated with exit code -1.
The process must be terminated with -1 exit code.
Must kill process.
The exec system call must return -1.
(Pintos does not have inheritance of file handles, so this must fail.) The parent process then attempts to use the file handle, which must succeed.
The process must be terminated with -1 exit code because the argument to the system call would be above the top of the user address space.
The process must be terminated with -1 exit code.
For Project 3: The bad address lies approximately 64MB below the code segment, so there is no ambiguity that this attempt must be rejected even after stack growth is implemented. Moreover, a good stack growth heuristics should probably not grow the stack for the purpose of reading the system call number and arguments.
This must work.
This may fail or terminate the process with -1 exit code.
The first call must wait in the usual way and return the exit code. The second wait call must return -1 immediately.
Tries to write to a mapping present in the parent. The process must be terminated with -1 exit code.
Then dereferences the address that we tried to map, and the process must be terminated with -1 exit code.
Definition at line 131 of file page-merge-seq.c.
References init(), merge(), sort_chunks(), and verify().
|
static |
Definition at line 108 of file page-merge-seq.c.
References buf2, fail(), histogram, and msg().
Referenced by test_main().
unsigned char buf1[DATA_SIZE] |
Definition at line 18 of file page-merge-seq.c.
Referenced by init(), merge(), and sort_chunks().
unsigned char buf2[DATA_SIZE] |
Definition at line 18 of file page-merge-seq.c.
size_t histogram[256] |
Definition at line 19 of file page-merge-seq.c.