C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 13th, 2003, 06:22 PM
Matthew Doucette Matthew Doucette is offline
matthewdoucette.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Posts: 635 Matthew Doucette User rank is Private First Class (20 - 50 Reputation Level)Matthew Doucette User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 8 m 16 sec
Reputation Power: 8
highly optimized file reading and writing?

I want to know if this is possible:

To write an array of data directly to the disk and then later read it back into memory without ever having to parse the data.

In more detail, the write to the disk would be an exact byte per byte copy, (done whichever way is the fastest and most optimized possible), directly from memory to disk, without worrying about data structures and variables. The read from the disk will be exactly the same, ignoring all data structures, variables, and any parsing what-so-ever. The read will directly overwrite the exact space in memory that is already declared. If this could be done, then I think this is the fastest way to store an array of data to disk that needs to be constantly reloaded into memory to be udpated and then quickly stored again.

Is this possible?
__________________
Matthew Doucette / Xona.com

Reply With Quote
  #2  
Old January 13th, 2003, 06:27 PM
Matthew Doucette Matthew Doucette is offline
matthewdoucette.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Posts: 635 Matthew Doucette User rank is Private First Class (20 - 50 Reputation Level)Matthew Doucette User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 8 m 16 sec
Reputation Power: 8
(BTW, I know that it would be faster to simply keep the data in memory and update the data in memory and then periodically write the whole thing to disk, especially seeing that this is a webpage application, but this is not an option as I have not learned how to do this yet.)

Reply With Quote
  #3  
Old January 13th, 2003, 07:56 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is online now
Banned ;)
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 8,100 Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 8 h 54 m 48 sec
Reputation Power: 2059
Yes, it is possible to do a write to disk and reread the data into a buffer. However, it sounds like you probably want to use shared memory instead, especially if you want to share some common data between multiple instances. This way, you can avoid disk I/O

Hopefully this link may prove to be useful.

Reply With Quote
  #4  
Old January 23rd, 2003, 11:37 AM
Matthew Doucette Matthew Doucette is offline
matthewdoucette.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Posts: 635 Matthew Doucette User rank is Private First Class (20 - 50 Reputation Level)Matthew Doucette User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 8 m 16 sec
Reputation Power: 8
Thanks for the link, Scorpions4ever, but I think I am going to try to save everything to disk before I learn how to code a server that handles requests and all of that.

Quote:
Originally posted by Scorpions4ever
Yes, it is possible to do a write to disk and reread the data into a buffer.
Ok, if I can do this, can I reread the data into a buffer located in the exact space of memory as an already defined and declared array, for example?

Reply With Quote
  #5  
Old January 23rd, 2003, 03:39 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is online now
Banned ;)
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 8,100 Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 8 h 54 m 48 sec
Reputation Power: 2059
Quote:
Originally posted by Doucette
Ok, if I can do this, can I reread the data into a buffer located in the exact space of memory as an already defined and declared array, for example?

Yes, you can. If you think about it, when you're reading any character string (whether from file or from console), you're putting it into an already defined and declared character array. The only thing you need to watch out for is to ensure that your buffer is large enough to contain the data that you're reading back into it.

Reply With Quote
  #6  
Old January 24th, 2003, 11:09 AM
Matthew Doucette Matthew Doucette is offline
matthewdoucette.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Posts: 635 Matthew Doucette User rank is Private First Class (20 - 50 Reputation Level)Matthew Doucette User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 8 m 16 sec
Reputation Power: 8
Excellent. This is obviously the fastest way to write data to a disc and later read it back. No parsing what-so-ever.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > highly optimized file reading and writing?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT