Re: Prioritize my own app's disk access
Re: Prioritize my own app's disk access
- Subject: Re: Prioritize my own app's disk access
- From: Alastair Houghton <email@hidden>
- Date: Tue, 05 Jul 2016 16:34:31 +0100
On 5 Jul 2016, at 13:36, Jonathan Taylor <email@hidden> wrote:
>
> This is a long shot, but I thought I would ask in case an API exists to do what I want. One of the roles of my code is to record video to disk as it is received from a camera. A magnetic hard disk can normally keep up with this, but if the user is also doing other things on the computer (e.g. long file copy in the Finder) then we are unable to keep up, and accumulate an ever-increasing backlog of frames waiting to be saved. This eventually leads to running out of memory, thrashing, and an unresponsive computer. Dropping frames is not an option. In this case, the computer is a dedicated workstation running my code, so it *is* correct for me to consider my code to be the number 1 priority on the computer.
>
> What I am wondering is whether there is some way I can communicate this requirement, to cause other apps such as the finder to get disk access at lower priority. Or alternatively, a way that I can demand high priority temporarily, at times when I identify that we have accumulated a save backlog?
Take a look at get/setiopolicy_np(). It isn’t clear from the documentation exactly what the default behaviour is; when I tried calling getiopolicy_np() I got IOPOL_DEFAULT, which isn’t even mentioned as a value on the man page, but you may find that setting your thread/process’s IO policy to IOPOL_IMPORTANT solves your problem.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden