Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
PPT.pptx
1.
2. xv6
► For multiprocessor x86 and RISC-V systems, xv6 is a contemporary
reimplementation of the Sixth Edition Unix Operating System. In 2006, it was
developed for educational purposes
► The fields for the kernel stack pointer, the trap frame, and the context deserve special
attention.
► The EAX, ECX, and EDX of these registers are known as callee-save registers,
whereas the EBX, ESI, EDI, ESP, EBP, and EIP are known as callee-save registers.
3. Handling Interrupts
Interrupts on each machine are assigned unique numbers (IRQs). An interrupt number
is set up during initialization. Every interrupt point to a universal function's IDT
entries, which we will examine shortly.
Once the kernel has started to run, it is not possible to change ESP; it must always take
place as part of the hardware CPU instruction.
4. Cont.
► As the kernel handles an interrupt, the trap frame is present on the stack. When the
scheduler switches out the process after handling an interrupt, the process context
that was written during the context switch is placed first, then the trap frame, on the
kernel stack. Furthermore, rather than using the kernel stack of the interrupted
process itself to handle interrupts, Linux has a separate interrupt context and related
stack.
5. PROCESS CREATION
• When a process calls fork, the general trap handling function calls the specific system call
fork function. K calls the allocproc function to allocate a free proc data structure..
• The allocproc function allocates a brand-new process data structure and kernel stack. On the
kernel stack of a new process, it pushes a context structure and a trap frame. The trap frame
is transferred from the parent to the child by the fork function.
6. SCHEDULER AND CONTEXT
SWITCHING
• In xv6, the following terms are used to describe process states: UNUSED, EMBRYO, SLEEPING,
RUNNABLE, RUNNING, and ZOMBIE. All of the proc structures are kept in a linked list. All actions
taken by the processes listed are secured by ptable.lock. When the scheduler function performs any
operation, the lock is always kept in place.
• The EIP, ESP, and a few additional general-purpose registers are preserved as a component of the
context. The registers of the currently executing process P1 are saved in their context on its stack, and
the registers of P2 are reloaded from its context, switching the CPU from P1 to P2.
7. FUNCTION OF SWITCHING
• The switch function is responsible for switching between an old context and a new
context. The switch is the only place where a process does not push the context structure
when it is created for the first time.
• Allocproc writes the context for a new process onto the new kernel stack, which switch
will load into the CPU registers when the process starts up for the first time.
8. PORTABLE.LOCK
• The portable.lock must be held by all functions that use the sched keyword. Process P1
locks portable.lock when the focus switches from it to process P2, which causes the
scheduler thread to switch back to process P2.
• Process P2 returns from the schedule and releases the lock when it is done. Except during a
context switch, when a lock is acquired by one process and released by the other, a process
that locks also typically does the matching unlock.