project 1. system call - androbenchcsl.skku.edu/uploads/swe3004s19/project1.pdf · project 1. make...

Post on 23-Sep-2020

83 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

SWE3004: Operating Systemsprof. Euiseong Seo

Project 1. System call2019.3.20 (Wed.)

TAs 김종석(ks77sj@gmail.com) /최동규(gmj03003@gmail.com)

Project plan

§Total 7 projects 0) Starting xv6 operating system (5%)1) System call (10%)2) Thread (15%)3) Syncronization (15%)4) Scheduling 1(10%)5) Scheduling 2(15%)6) Page fault handler (15%)7) Copy on Write (15%)

Notice

§ http://csl.skku.edu/SWE3004S19/Projects

§ Project related notices are uploaded here.

§ Also lab class places can be changed every time.

Trap Handling Process on xv6

§ Example : kill system call

kill.c (user level)

user.h

Trap Handling Process on xv6

make qemu-nox | grep usys

Trap Handling Process on xv6

usys.S

traps.h

syscall.h

Trap Handling Process on xv6

Process P

RAM

movl $6, $eaxint $64

syscall sys_kill

trap-table index syscall-table index

Trap Handling Process on xv6

trap.c

Trap Handling Process on xv6

vectors.S

trapasm.S

Trap Handling Process on xv6

Trap Handling Process on xv6

trap.c

Trap Handling Process on xv6

syscall.c

Trap Handling Process on xv6

sysproc.c

proc.c

Project 1. Make System Calls

§ Goal : make new three system calls(getnice, setnice, ps)§ Synopsis

§ int getnice(int pid);§ int setnice(int pid, int value);§ void ps(int pid);

§ Description§ The getnice function obtains the nice value of a process. The setnice

function sets the nice value of a process.§ The default nice value is 20. Lower nice values cause more favorable

scheduling. The range of valid nice value is 0~39§ The ps function prints out process(s)’s information, which includes pid, nice,

status, and name of each process. If the pid is 0, print out all processes’ information. Otherwise, print out corresponding process’s information. If there is no process corresponding to the pid, print out nothing.

Project 1. Make System Calls

§ Return value§ getnice : Return the nice value of target process on success. Return

-1 if there is no process corresponding to the pid.§ setnice : Return 0 on success. Return -1 if there is no process

corresponding to the pid or the nice value is invalid.§ ps: No return value.

Test with User Program

hello.c

Makefile

Test with User Program

Submission

• You should enter your ID & project no. (this time is 1) on Makefile

• $make tarball

• Then, xv6-project-1-studentID.tar.gz will be created in the parent folder.

Submission

• From now on, you need to submit a document.

• Just write how you implemented your code.

• You can use English or Korean.

Submission

• Send your code file (xv6-project-1-studentID.tar.gz) and document file to gmj03003@gmail.com

• Please send a mail with tittle including [SWE3004]• Ex) [SWE3004] 2014111111-project1

• PLEASE DO NOT COPY• YOU WILL GET F GRADE IF YOU COPIED

• Due date: 3/26(Tue.), 23:59:59 PM• Every one day delay, -25% penalty of the project score

Questions

• If you have questions, please email to TA

• You can also visit #85533. Please email TA before visiting

top related