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

21
SWE3004: Operating Systems prof. Euiseong Seo Project 1. System call 2019.3.20 (Wed.) TAs 김종석([email protected]) / 최동규([email protected])

Upload: others

Post on 23-Sep-2020

63 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

SWE3004: Operating Systemsprof. Euiseong Seo

Project 1. System call2019.3.20 (Wed.)

TAs 김종석([email protected]) /최동규([email protected])

Page 2: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

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%)

Page 3: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Notice

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

§ Project related notices are uploaded here.

§ Also lab class places can be changed every time.

Page 4: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

§ Example : kill system call

kill.c (user level)

user.h

Page 5: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

make qemu-nox | grep usys

Page 6: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

usys.S

traps.h

syscall.h

Page 7: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

Process P

RAM

movl $6, $eaxint $64

syscall sys_kill

trap-table index syscall-table index

Page 8: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

trap.c

Page 9: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

vectors.S

trapasm.S

Page 10: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

Page 11: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

trap.c

Page 12: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

syscall.c

Page 13: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Trap Handling Process on xv6

sysproc.c

proc.c

Page 14: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

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.

Page 15: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

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.

Page 16: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Test with User Program

hello.c

Makefile

Page 17: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Test with User Program

Page 18: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

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.

Page 19: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Submission

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

• Just write how you implemented your code.

• You can use English or Korean.

Page 20: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Submission

• Send your code file (xv6-project-1-studentID.tar.gz) and document file to [email protected]

• 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

Page 21: Project 1. System call - AndroBenchcsl.skku.edu/uploads/SWE3004S19/project1.pdf · Project 1. Make System Calls §Return value §getnice: Return the nice value of target process on

Questions

• If you have questions, please email to TA

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