what is difference between system call and library function
Unless you are talking about a specific implementation, the spelling
of the name. What is a system call on one machine may be a library
function on another, and it can easily change between versions (e.g.
when a legacy system call is now implemented as a library function
that calls the new system call, re-arranging the arguments and
results so it works like the old one did).
Does library function call can have context switch to kernel
mode?
Yes, as a library call often calls system calls (at least conditionally)
to do its work. For example, if you call putc() a lot, at least
some of them will call something in the kernel to actually get the
I/O done, at least on UNIX-like systems where there is a kernel.
Gordon L. Burditt