Skip to content

Exit system call

Arguments

None

Return Value

None

Description

Exit system call terminates the execution of the process which invoked it and destroys its memory address space. The calling application ceases to exist after the system call and hence the system call never returns.

Data structures modified are Memory Free List, Disk Free List, Open File Table, Semaphore Table, System Status Table, Resource Table and the Disk Map Table.

Control flow diagram for Exit system call

Algorithm


Set the MODE_FLAG in the process table entry to 10.

//Switch to the Kernel Stack. see kernel stack management during system calls
Save the value of SP to the USER SP field in the Process Table entry of the process.
Set the value of SP to the beginning of User Area Page.

Invoke the exit_process() function from the Process Manager module.

/* exit_process() releases all the memory pages of the process including the page holding kernel stack.
Still, as exit_process is non-blocking, the kernel stack page will not be allocated to another process.
This makes it possible to make a final call from the process to the scheduler. There is no return to
the process after the following scheduler invocation. */ 

Invoke the context_switch() function in the Scheduler Module.

Back to top