I finally wanted to understand in the "scenario" & think Hard!
One system calls do_fork ()
1 Current process call fork () creation sub-process, enter Kernel
2 The current process is more than half of the time film to the child process.
3 If the current process time is 0, set the current process NEED_SCHED = 1,
4 exit from system call
5 reach RET_FROM_SYS_CALL
6 reach RET_WITH_RESCHEDULE
7 Discover the current process requirements to schedule, jump to reschedule
8 call schedule ()
9 schedule () handle the scheduling requirements of the current process,
10 If there are other processes to run, switching will occur within Schedule ().
Two-time clock DO_TIMER ()
11 When the timing clock occurs, 8235-> IRQ0-> do_timer_interrupt () -> do_timer ()
12 -> Update_process_times () Decrement the time film of the current process,
13 If the current process time piece is 0, set the current process NEED_SCHED = 1,
14 Exit from interrupt calls,
15 reaches RET_FROM_INTR
16 reach RET_WITH_RESCHEDULE,
17 Discover the current process requirements dispatch, jump to reschedule
18 call schedule ()
19 schedule () handling the scheduling requirements of the current process,
20 If there are other processes to run, switching will occur within Schedule ().
Three wake-up process wake_up_process ()
21 Current Process Call fork () creation sub-process, enter Kernel
22 The current process calls wake_up_process to wake up the process x
23 Make the process x state to running, and join the Runqueue queue,
24 call reschedule_idle ()
25 Discovery Process X is more eligible to run than the current process, set the current process NEED_SCHED = 1,
26 Quit from the system call
27 arrive at RET_FROM_SYS_CALL
28 arrival RET_WITH_RESCHEDULE
29 Discover the current process requirements to schedule, jump to reschedule
30 call schedule ()
31 Schedule () Processes the scheduling requirements of the current process,
32 If there are other processes to run, switching will occur within Schedule (). This majority may switch to the process x
Four change process scheduling strategy setscheduler ()
33 Enter system call setscheduler ()
34 Changing process x scheduling strategy
35 Admon Procedure x Location in the Runqueue queue
36 Set the current process NEED_SCHED = 1,
37 exiting from system call
38 reaches RET_FROM_SYS_CALL
39 arrived RET_WITH_RESCHEDULE
40 found that the current process requires scheduling, jumps to reschedule
41 call schedule ()
42 schedule () handles the scheduling requirements of the current process,
43 If there are other processes to run, switching will occur within Schedule ().
Five system call gifts SYS_SCHED_YIELD ()
44 Enter system call sys_sched_yield ()
45 If there are other processes, let go of ceremony,
46 Set the current process NEED_SCHED = 1,
47 exiting from system call
48 arrived RET_FROM_SYS_CALL
49 arrived RET_WITH_RESCHEDULE
50 found that the current process requires scheduling, jump to reschedule
51 calls schedule () 52 schedule () Processes the scheduling requirements of the current process,
53 If there are other processes to run, switching will occur within Schedule ().
NEED_SCHED indicates that the CPU returns from the system space to the eve of the user space.