Newsgroups: alt.os.development, comp.os.minix
From: "Marven Lee" <marve...@gmail.com>
Date: Fri, 16 Sep 2011 11:06:01 +0100
Local: Fri, Sep 16 2011 6:06 am
Subject: Multithreaded filesystem using cooperative scheduling
I started thinking about send/receive message passing
microkernels again instead of the migraring thraad/protection ring ideas that I've often considered. This lead me to think about how to add concurrency to a single threaded filesystem. From reading old posts I gather there was a multithreaded filesystem for Minix but couldn't find out anything about it. So a few ways I thought:
1) State machine.. FS queues messages and handle them
2) Multithreaded FS. Each thread handles a different request,
3) Migrating Threads. Allow a thread to cross from one
So last night I did some reading of old posts hoping to find info
Filesystem runs on single thread but uses separate stacks for each
Having a stack is much easier than a state machine and storing
// Main co-op thread, responsible for receiving messages
void Main()
if (msg.type == client_request)
Yield(); // Starts running co-op threads.
// Optimization would run only this new
Yield();
// Process list of IORequests (read_block/write_block etc)
for (each IO Request)
}
// A co-op thread/stack is created to handle a Read request
void Read (struct Msg msg)
struct IORequest ioreq;
if (block->in_cache == true)
While (block->in_cache == false)
MemCopy_To_Client();
// The wrapper code upon return will remove this
}
It is pseudo-code so things like Read() would be more
complicated, it would be a loop until nbytes are read for example. Needs co-op thread for each filesystem request, so possibly
Some optimizations possible, don't run through all threads when
Could maintain queues of threads for each cache block and
Maybe it is still a bottleneck with only one real thread running
PS: Haven't thought it through completely, thought about it last
-- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||