I created this thing and named a 'pipe' for want of a better name. My question, Is it a pipe? Does it fit the categories?
Creation: Allocates some memory and fills some info, then signals a pipe_created signal to all programs.
Reading: Reads from current_position to length and puts it into a buffer.
(you can set current_position)
Another question.....when reading some data, does that data get deleted? How does the kernel know what data is used so another program doesn't overwrite it?
Writing: Writes data from from buffer from current_position to length, then sends a PIPE_WRITTEN signal to all programs.
I'm considering re-naming it.....to......message, box, idk...something.
-JL
Is it a pipe? Or is it a.....?
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Is it a pipe? Or is it a.....?
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Thats similar to the way pipes are implemented in my operating system. They are just circular buffers in shared memory. The data structure itself is not a pipe but a simple buffer, but it can be used as a pipe. Operations on messages are usually atomic (the receiver either gets the full message or no message at all) so I would not call this structure a message box.
The easiest way to handle this is having two pointers/position counters: One pointer to the current "read offset" and one to the current "write offset". Usually a circular buffer is used for data structures like that. You don't have to delete the read data although there are some implementations that delete it, e.g. some lock-free pipe implementations.Another question.....when reading some data, does that data get deleted? How does the kernel know what data is used so another program doesn't overwrite it?