CIS 5502 Introduction of Operating Systems
Saturday, October 27 2007 at 21:30, posted by Norman
Saturday, December 22 2007 at 21:30, updated by Norman
When comes to study the core of an OS, Linux will be the best choice. So in this course, all programs are written under Linux or UNIX. I really don't think anybody can learn it good without basic unix/linux knowledge. So I put a few useful tips in my linux section.
What I like most about this course is the Projects. In this course, I refined my C programming skills, learned IPC, multi process, multithread and tcp/ip socket programming,
Project 1. Matrix multiplication: warm up with c, perl and makefile.
Project 2. Linux Shell: write a shell. First, use fork() to create a new process then use execv(cmd, arguments) to execute the command. Actually implement the internel command and store the system enviroment took me more time.
Project 3. IPC: Inter Process Communication
the message queue part: just remember send a 0 length when the sender program finish, so the receiver program can catch a 0 length message as a termination signal.
the pipe part: you can not set the length to be bigger than the real message. So what I did is send every message length to be message length, then all message to be at least 2 char length. Then I use 1 lenth message as the termination signal.
Project 4. ls: Write a ls command. Most parts are easy, except to get the size of the terminal window.
Project 5. Simulation of building security system: This project simulated a security system. The logic isn't complicated, but it used tcp/ip communication, multithread and database technology to implement the system. It will be easy if use function pointer. Here is a simple example:
void Op1();
void Op2();
void Op3(int i); //define functions
....
int main() {
...
static void (*op_func[])(int) = { Op1, Op2, ....};
s = int ...; //using s to select which functions to call
(* op_func[this_op])(s); //call function
}