60 likes | 157 Vues
Learn how to implement new system calls, modify entry files, update makefiles, and compile new kernels for OS development. External variable declaration and PThread library usage explained in detail with useful links.
E N D
CS 416- Fall 2008Session 02 TA: Tuan Phan Email: tphan@cs.rutgers.edu 732-445-6450 (ext 9644) : Just leaving msg( prefer using Email, with HEADER: [CS416] …) Recitation: TH :3:35pm – 4:30 PM @ SEC 202 Office Hour: TH 5:00 – 6:00 PM @ Hill 367 Another place to find me: PANIC LAB, CORE 340 Extra: Email to setup appointment on Monday afternoon. TA’s Web Site: http://paul.rutgers.edu/~tphan/cs416/ Slides for recitation, Useful Links
Today’s topics • Remind about the submission system • Project 1 • New system_call howto? • Where to insert the counting variables? • fork, vfork, execve & clone. • PThread Library
ADD NEW SYSTEM CALL - SUMMARY • Modify entry.S, unistd.h • Create chad.c & chad.h -> ~linux/kernel/ • Update the Makefile • Compile the new kernel.
sys_fork() • ~linux/arch/i386/kernel/process.c • asmlinkage int sys_fork(struct pt_regs regs) { return do_fork(SIGCHLD, regs.esp, ®s, 0); }
Using extern • The extern keyword is used to inform the compiler about variables declared outside of the current scope. • E.g: • extern int fork_count; • extern void my_function(int a, int b);
Pthread Tutorial • Links: • https://computing.llnl.gov/tutorials/pthreads/