OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Jan 21, 2018 2:22 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Transparent system call batching?
PostPosted: Sun Jan 07, 2018 8:13 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 567
Location: Moscow, Russia
Hi, OSDev, haven't been posting here for a while!

You might have heard about batch system calls that, however, have the drawback of requiring application support. What if instead of directly dispatching the issued system calls to the kernel the standard library would add them to a queue (without calling the kernel) which upon certain conditions (expiration of a time slice?) would be reaped by the kernel? This way the overhead of system calls could be shrank — such would be especially beneficial given the recent events (publication of Meltdown and Spectre whose mitigations require costlier system calls). I wonder if this technique is a good idea for either a POSIX system or a novel OS design.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: Transparent system call batching?
PostPosted: Sun Jan 07, 2018 8:25 am 
Offline
Member
Member
User avatar

Joined: Wed Dec 01, 2010 3:41 am
Posts: 1755
Location: Hong Kong
The problem is you can't batch them if application want results immediately. To enable batched system call, the calls themselves needed to be designed with async nature in mind.

PS. interrupts on the other hand, can be batched that way (e.g. certain NIC support that) to reduce context switching.


Top
 Profile  
 
 Post subject: Re: Transparent system call batching?
PostPosted: Sun Jan 07, 2018 8:52 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 567
Location: Moscow, Russia
@bluemoon: I see your point, but if hybrid threading was used then the standard library could simply switch to a different thread with no system call overhead. If no non-blocked threads were found then it would call the kernel to process the queue prematurely.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: Transparent system call batching?
PostPosted: Sun Jan 07, 2018 11:49 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 426
I think that this can work if it is combined with explicit (and not implicit) flushes. One problem with implicit flushing is that you actually want system calls to issue I/O requests as fast as possible to avoid introducing additional latency. However, the greatest problem here is that existing APIs like POSIX and the C and C++ standard libraries expect most calls (e.g. memory allocation, thread creation, thread synchronization, IPC and I/O) to be blocking and that does not work with explicit flushing: It forces you to flush for single system calls and thus does not improve performance.


Top
 Profile  
 
 Post subject: Re: Transparent system call batching?
PostPosted: Sun Jan 07, 2018 11:55 am 
Offline
Member
Member
User avatar

Joined: Wed Dec 01, 2010 3:41 am
Posts: 1755
Location: Hong Kong
Roman wrote:
@bluemoon: I see your point, but if hybrid threading was used then the standard library could simply switch to a different thread with no system call overhead. If no non-blocked threads were found then it would call the kernel to process the queue prematurely.


This would make batch possible, but create a side effect that might not be desired: calling kernel means yielding a thread, if the scheduler itself is sophisticated it may create unpredictable results.


Top
 Profile  
 
 Post subject: Re: Transparent system call batching?
PostPosted: Mon Jan 08, 2018 10:34 am 
Offline
Member
Member

Joined: Wed Aug 08, 2012 6:39 am
Posts: 29
Location: San Francisco, CA
You might be interested in reading the FlexSC paper, where they implement a similar method.

https://www.usenix.net/legacy/events/os ... Soares.pdf

_________________
Cheers,

Lev


Top
 Profile  
 
 Post subject: Re: Transparent system call batching?
PostPosted: Mon Jan 08, 2018 11:06 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 567
Location: Moscow, Russia
lkurusa wrote:
You might be interested in reading the FlexSC paper, where they implement a similar method.

https://www.usenix.net/legacy/events/os ... Soares.pdf
Thanks for the link, I'll definitely check it out.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 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