OSDev.org

The Place to Start for Operating System Developers
It is currently Sun May 12, 2024 4:11 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Is it a pipe? Or is it a.....?
PostPosted: Wed Apr 02, 2008 8:45 am 
Offline
Member
Member
User avatar

Joined: Thu Dec 21, 2006 7:42 pm
Posts: 1391
Location: Unknown. Momentum is pretty certain, however.
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

_________________
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 9:35 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
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.

Quote:
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?

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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 03, 2008 7:27 am 
Offline
Member
Member

Joined: Tue Mar 04, 2008 12:32 pm
Posts: 32
i have unix pipes in my system(because it is modeled after docs and manpages of different unix,bsd ,linux uzi,solais,minix...) but i dont use a socket like some bsd versions.I use a page sized shared buffer and my code is a small vfs that uses an inode and works for pipes and fifos.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group