1 / 28

JOSLAB 4

JOSLAB 4. Three Parts. Deadline: One week for each part, so that you don’t need to rush the deadline MUST finish them before 6.11 Submit: Code & Document Lab Interview Soon after the deadline Your need to do Answer TA’s questions and demo Prepare your slides (optional).

dard
Download Presentation

JOSLAB 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JOSLAB 4

  2. Three Parts • Deadline: • One week for each part, so that you don’t need to rush the deadline • MUST finish them before 6.11 • Submit: • Code & Document • Lab Interview • Soon after the deadline • Your need to do • Answer TA’s questions and demo • Prepare your slides (optional)

  3. After JOSLAB3 • JOS After LAB3 • You can run a single process and call some system call

  4. ONLY ME ???

  5. Real Bad Life: Many Processes

  6. Problem NOW • How to ensure the order? • Many processes?

  7. Solution • Operating System Schedule

  8. Part A: Scheduling • Round-Robin Scheduling • Loop envs array and run it. • Note • A process enters kernel by two ways • Sysenter instruction (system call) • Trap (Pagefault blablabla……) • Hint :you can create a trap frame like structure for system call

  9. Process Creation

  10. Part A: Environment Creation • Unix-like fork • Create a new process • Sys_exofork : inc/lib.c • A library wrapper for sys_exofork • Use “INT” instruction to implement it • Much easier than sysenter

  11. Part A:Reading materials • Unix Fork function • Understanding Linux Kernel • Creating Process .etc • INT instruction • Document and IA-32 Intel Architecture Software Developer's Manual, Volume 2A. • Documents about trap in LAB3

  12. Part A: Q & A • Question need to answer • What’s the difference between fork in Linux and in JOS. • Why “INT” instruction is much easier than “sysenter” for exo_fork system call? And why exo_fork wrapper function must be an inline function? • Answer these questions in the document1

  13. Process Creation 2

  14. Part B: Copy-On-Write Fork • What is copy on write? • Understanding Linux Kernel (Wu Gang’s Linux course) • Process Address Space • Why & How to copy on write? • You will find the answer during this lab 

  15. Part B: Copy-On-Write Fork • User-level page fault handling • User-level: Difference between Linux and JOS • JOS is a LibOS!(problem one in homework 2)

  16. Part B: Q&A • Mechanism need to understand • How to invoke the user pg fault handler? • What stack is used in pg fault handler? • Where does the pg fault handler return to? And how do you makeit? • Questions need to think • What’s the benefits of user-level pg fault handler? • Needn’t to answer them in doc, just thinking is OK. 

  17. Part B: Copy-On-Write Fork • Fork() in lib/fork.c • Dumbfork() in test case dumbfork.c maybe helpful to you. 

  18. Malicious Process

  19. Part C: Clock & IPC • Problem now: • Some process like a infinite loop will always occupy the CPU resource • Solution • Preemption

  20. Process Communication

  21. Part C: Preemption • Clock Interrupt • Intel Manual is a good friend when you confused. • Note • Don’t forget to enable interrupt when exit from the kernel • JOS will disable interrupt when enter the kernel

  22. Part C: Q&A • Mechanism need to understand • What’s the difference between interrupt mechanism and exception? • What will trigger an interrupt? And how CPU is notified and handle it? • You can find this answer in Intel Doc • Also just thinking is OK

  23. Part C: Preemption • You haveclock interrupt now, you can do preemption easily. • Intuitive • Reschedule task when an timer event happened.

  24. Part C: IPC • Adelicious dessert if you finished all things before by yourself  • IPC in JOS is really simple and trivial • So I won’t give too much comments here

  25. END??? NO!!!

  26. Suggestion • You can have a discussion but don’tcopy • You should understand the code you write • Why write? • How to write? • Can be more perfect? • Debug is a good way to learn • Don’t fear a bug.

  27. REAL END  Just enjoy it and have fun~

  28. Q&A • Email TA(liwenhaosuper@gmail.com) • Come to TA’s office at Room 3402. • Service is available during 9:00-24:00

More Related