N
N
nano_e_t_42016-11-18 13:07:05
Operating Systems
nano_e_t_4, 2016-11-18 13:07:05

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

2 answer(s)
A
Alexey Cheremisin, 2016-11-18
@nano_e_t_4

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).

D
DVamp1r3, 2016-11-18
@DVamp1r3

Memory of a certain size is allocated (and where a different story is allocated, but more likely in RAM) A
pointer to the address to which to read / write and the size is transmitted so as not to write too much / overflow the buffer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question