Where is the cursor stored for a file?
- every time there's system call
open(), a new entry is generated for the open file table. - if process
forks, both the parent and child share a pointer to the same open file entry, and therefore their cursors will be the same.
Assignment 2: The Unix v6 Filesystem
-
to write a program in C(not in C++) that can read from a 1970s-era Unix version 6 filesystem.
- the test data you are reading from are literally bit-for-bit representations of a Unix v6 disk.
-
writing code in for different files
- inode.c
- file.c
- directory.c
- pathname.c
-
since it's in C, you'll have to rely on arrays of structs, and low-level data manipulation, as you don't have access to any C++ standard template library classes.
-
must formulate your questions to be conceptual enough
More on Multiprocessing
waitpidcan be used to temporarily block one process util a child until a child process exit.pid_t waitpid(pid_t pid, int *status, int options);pidspecifies thewait set*statussupplies the address of an integer where termination information can be placed(or we can pass inNullif we don't care for the information)optionsis a collection of bitwise-or'ed flags. for the time being, we'll just go with 0 as the required parameter value, which means thatwaitpidshould only return when a process in the supplied wait set exists.- return value is the pid of the child that exited, or
-1if waitpid was called and there were no child processes in the supplied wait set.