6.828 goals
What do applications want from an O/S?
What is an OS?
Organization: layered picture h/w: CPU, mem, disk kernel: [various services] user: applications, e.g. vi and gcc
What services does an O/S kernel typically provide?
What does an O/S abstraction look like?
Examples, from UNIX / Linux:
fd = open("out", 1);
write(fd, "hello\n", 6);
pid = fork();
Why is O/S design/implementation hard/interesting?
fd = open(); ...; fork()
You'll be glad you learned about operating systems if you...
See web site: https://pdos.csail.mit.edu/6.828
Lectures
Lab: JOS, a small O/S for x86 in an exokernel style
Code review
Two quizzes: one in class hours, one in final's week
6.828 is largely about design and implementation of system call interface. let's start by looking at how programs use that interface.
a simple example: what system calls does "ls" call?
simpler program: echo
a more interesting program: the Unix shell.
errno
,
perror
prints out a descriptive error
message based on errno
.what does wait() do? waits for any child to exit what if child exits before parent calls wait?
how to execute echo?
if (execv(ecmd->argv[0], ecmd->argv) == -1) {
perror("exec failed");
exit(-1);
}
how to do I/O redirection (i.e., >)
close(rcmd->fd);
if(open(rcmd->file, rcmd->mode, S_IRWXU) < 0) {
perror("open failed\n");
exit(-1);
}
cool: echo doesn't need to be changed at all!
Homework assignment for shell