File Operation Levels sh scripts user commands library IO fu
File Operation Levels:
sh scripts
user commands
library I/O
functions system calls
a/ What\'s the relationship (if any) among the levels?
b/ What\'s the relationship between the following open, read, write fopen, fread, fwrite
c/ Write C code to:
open a file for READ; read the SECOND block of 1024 bytes into a buf[]
open a file for WRITE (CREAT if needed); write a string of chars to it.
When copy files, which is BETTER? by syscall OR by Lib I/O? WHY____________
Solution
a)
Ans)
the relationship among the levels is given below clearly.
1. Actually There are three different type of levels they are run-level1, run-level3 and run-level5
2. In run-level 1 it is used only for the single-user
3. In run-level 3 it is used for multi-user text mode and by default it permits one to six several users.
4. In run-level 5 it is used for multi-user graphical mode and if you want GUI then you have to use this level
b)
Ans)
the relationship between the open, read, write fopen, fread, fwrite are given below clearly.
1. Basically open, read, write comes under one family that is read().
2. now fopen, fread and fwrite comes under one family that is fread().
3. In read family they are called as system calls and they are not formatted IO that means we have a non formatted byte stream.
4. In fread family they are the functions of the standard C library and they also uses an internal buffer.
5. and They always use the Linux buffer cache.
Hope This Helps, if you have any doubts Please comment i will get back to you, thank you and please thumbs up