c - How does scanf() work inside the OS? -
I was wondering how scanf () / printf () actually works in hardware and OS levels Where data flow And what does the OS do around these times? What does the OS call? And so on ...
scanf () and printf () are functions in libc (C standard library ), And they write the order (and) write the operating system (cscl), talk to the file descriptor, staden and stadet respectively (fscanf and fprintf allow you to specify the file stream that you read / write Want)
Write calls () and () (and (and all syscalls) to read, the result of 'context switch' in kernel mode from your user-level application, which means that this privileged task Can do that, directly talking directly to the hardware Depending on how you started the application, 'stdin' and 'stdout' file descriptors may be compelled to either console devices (such as TTE), or to some type of virtual console device (as revealed by extram). Read () and write () securely copy data from a kernel buffer / 'UIO'.
The draft-string converter portion of scanf and printf is not in kernel mode, but simply in the ordinary user mode (inside 'libc'), the common rule of thumb is with cicocol, in kernel mode Sometimes switch, as much as possible, to avoid overhead of context switching and to be safe (you should be very careful about anything that happens in kernel mode!) Less code in kernel mode means operators C fewer bugs / security holes in the system).
BTW .. All this was written with a unix perspective, I do not know that MS Windows works.
Comments
Post a Comment