Answer the question
In order to leave comments, you need to log in
What for at record\reading to specify the buffer?
Hello everyone
I'm studying Tanenbaum's work on operating systems, I read that to read a record on a disk, a system call is made, which receives the file to be read, a pointer to the buffer and the number of bytes to be read / written as arguments.
Explain plz, who knows - what kind of pointer to the buffer - meaning a pointer to memory cells in RAM that need to be written? (respectively when recording).
What is this reading argument?
Thanks
Answer the question
In order to leave comments, you need to log in
A pointer is the address of a allocated area (section or block) of memory where data will be written or read from for reading / writing. The second argument is the number of bytes to read/write.
In other words, the algorithm is as follows:
1) we ask the system for a free area of memory of the size we need, in response the system gives us the address of the beginning of the allocated memory (pointer to the beginning of memory)
2) We open the file for reading or writing
3) We ask the system to read or write data by memory addresses from point 1). We also tell the system not to read / write more than we have allocated memory, for this we pass the number of bytes that need to be read or written.
4) The system reads / writes information to the file and places it at the addresses from point 1). Also, the system, after writing / reading, gives us the actually read / written number of bytes (for example, we read from a smaller file).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question