Your SlideShare is downloading. ×
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply



Published on

its a simple presentation for system call

its a simple presentation for system call

Published in: Education, Technology, Sports

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Algorithm of
    Mahesh Shitole
    Associate Software Engineer
    Knowledge Quest Infotech
  • 2.
    • All the system calls are declared in C library. so when process makes system call linker links function call to name of it in this Library.
    • 3. The Library Doesn’t have code , it just have
    • 4. Name of the function
    • 5. Trap instruction
    Code reside in kernel.
    • when system call made it invoke Trap instruction it generate interrupt and h/w switch to the kernel mode.
    • 6. After creating OS Trap library pass a unique no. to kernel.
    • 7. it can pass this either using
    • 8. As a parameter to instruction itself
    • 9. On the stack
    depending upon machine.
  • 10.
    • Now we enter in kernel mode.
    • 11. There is a table of System calls. In which kernel finds appropriate
    require function address using index. This address are nothing but entry point of system call.
    • parameters :
    • 12. we know process has 2 stacks kernel stack & user stack in the frame of user stack there are parameters of called function , so using user stack pointer it adds or subtracts an offset & get the parameters of system call.
    • 13. it copies this parameters to the Process’s U area & start executing the code of system call.
    • After Executing System call
    two situation are
    • Success with or without return value:
    process state register (PS) field carry bit is set which is used in error situation. Here there is no error so kernel clear this bit.
    and copies return values into 0th & 1st register of
    register level context . (Data register)
    • Error with return value:
    when the kernel determine the execution of system call completed with some error , it sets the carry bit in process status register (PS). & copies the error no into the 0th register
    of register context.
    • Here the job of system call i.e. OS Trap is done. Kernel returns to
    to the library where Trap was created.
    library checks the status of PS register & take appropriate action.
    usually they return it to caller process & process takes action.
  • 14. algorithm : syscall /* from invocation of system call *
    input : system call number (takes from “trap”)
    find entry in “system call table” corresponding to system call number;
    determine number of parameters to the system call;
    copy parameters from “user address space” to U area;
    save current context for abortive return;
    invoke the code of system call reside in kernel;
    if(error during execution of system call)
    set register 0 in “register context” to the error number;
    turn on “carry bit” in “process status” register in register context;
    else /* success */
    set register 0 and 1 in “register context” to return values of system call;
    output : result of system call.