disk

How to handle large numbers of concurrent disk write requests as efficiently as possible

空扰寡人 提交于 2019-12-18 21:51:33
问题 Say the method below is being called several thousand times by different threads in a .net 4 application. What’s the best way to handle this situation? Understand that the disk is the bottleneck here but I’d like the WriteFile() method to return quickly. Data can be can be up to a few MB. Are we talking threadpool, TPL or the like? public void WriteFile(string FileName, MemoryStream Data) { try { using (FileStream DiskFile = File.OpenWrite(FileName)) { Data.WriteTo(DiskFile); DiskFile.Flush()

Cross platform way to list disk drives on Linux, Windows and Mac using Python?

佐手、 提交于 2019-12-18 20:18:06
问题 I am using Python2.6. I am trying to list the disk drives that a system may have. On Windows, it may be something like C:/ , D:/ , E:/ , etc. On Linux, it may be something like /boot , /media/SDCard , etc. And I don't know what it's like on a Mac. Maybe something under /Volumes. Does anyone know of a cross platform way (that is, one which works on Linux, Windows and Mac) in Python? Thanks! 回答1: There isn't really a unified naming scheme for Linux devices that guarantees you a formatable block

Are tables created with “CREATE TEMPORARY TABLE” in memory or on disk?

人盡茶涼 提交于 2019-12-18 11:44:51
问题 In MySQL , when you create a temporary table, for example, CREATE TEMPORARY TABLE ... , is that table created and held in memory or on the disk? I have read through the docs and Google'd it and have not come up with an answer. 回答1: It depends on what engine you specify. By default the table data will be stored on disk. If you specify the MEMORY engine, the data will only be stored in memory. It should be possible to actually find the files that are created in the filesystem when the temporary

Xcode 4 became extremely slow and kills my hard drive

早过忘川 提交于 2019-12-18 10:49:16
问题 My machine has 8 GB or RAM, Core 2 Duo 3,06 GHZ and it seems it is not enough for Xcode 4 (4.0.1). From some time now it started to behave more and more slow. Auto completion, editing code as well as Xib files became almost impossible to use. Other applications behave smoothly. Activity monitor shows a lot of RAM usage (still few GB left of completely free memory, so it is quite OK) and huge disk activity usage. I can see on the graph high peaks of data being saved periodically when I work in

How to open disks in windows and read data at low level?

孤街醉人 提交于 2019-12-18 04:21:50
问题 I know in linux it is as simple as /dev/sda but in Windows how do you open a disk and start reading data at the low level? In python I've tried: f = open("K:", "r") and I get this error: Traceback (most recent call last): File "<stdin>", line 1, in <module> IOError: [Errno 13] Permission denied: 'K:' I get this error even as administrator. 回答1: From http://support.microsoft.com/kb/100027 To open a physical hard drive for direct disk access (raw I/O) in a Win32-based application, use a device

How to open disks in windows and read data at low level?

和自甴很熟 提交于 2019-12-18 04:21:14
问题 I know in linux it is as simple as /dev/sda but in Windows how do you open a disk and start reading data at the low level? In python I've tried: f = open("K:", "r") and I get this error: Traceback (most recent call last): File "<stdin>", line 1, in <module> IOError: [Errno 13] Permission denied: 'K:' I get this error even as administrator. 回答1: From http://support.microsoft.com/kb/100027 To open a physical hard drive for direct disk access (raw I/O) in a Win32-based application, use a device

How to download files directly to disk on the iPhone os?

岁酱吖の 提交于 2019-12-17 22:35:01
问题 I would like to download files directly from an URL to the disk using objective-c on the iPhone os. Currently I am using NSURLConnection to send a synchronousRequest, writing the returned NSData into a file. How can I change the download handling (still having the request beeing synchronous, it is already in a background thread) to write the data directly to disk, not using memory variables to store the complete content (only small parts)? A sample code would be appreciated. Thank you all in

What is a sparse file and why do we need it?

邮差的信 提交于 2019-12-17 20:45:08
问题 What is a sparse file and why do we need it? The only thing that I am able to get is that it is a very large file and it is efficient(in gigabytes). How is it efficient ? 回答1: Say you have a file with many empty bytes \x00 . These many empty bytes \x00 are called holes. Storing empty bytes is just not efficient, we know there are many of them in the file, so why store them on the storage device? We could instead store metadata describing those zeros. When a process reads the file those zero

How to explicitly lock a mounted file system?

霸气de小男生 提交于 2019-12-17 20:01:15
问题 How do i write to a physical drive in Windows 7? I am trying to write to a physical disk (e.g. \\.\PhysicalDrive0 ) in Windows 7. This question has been asked to death , but has never been answered. It is something that used to work in Windows XP, but Microsoft intentionally broke in Windows Vista. Microsoft provides hints about how to do it, but nobody has even been able to figure it out. It used to work In the olden days, writing to a physical disk was allowed (as long as you were an

Physical disk size not correct (IoCtlDiskGetDriveGeometry)

℡╲_俬逩灬. 提交于 2019-12-17 19:11:15
问题 I use the code below to get the physical disk size , but the size returned is not correct. I've checked the size with other tools. The code below reports Total disk space: 8.249.955.840 bytes and it should be Total disk space: 8.254.390.272 bytes How can I retrieve the actual/correct physical disk size? Tested on USB drives and normal hard drives. The code is long, here separate it in parts to show. The structure: [StructLayout(LayoutKind.Sequential)] internal struct DiskGeometry { public