Solved

locking hard drive while reading sectors

Posted on 2002-06-08
13
208 Views
Last Modified: 2012-05-04
i am using int 21h function 7305h extended absolute disk read write
to access my 20GB hard drive.i am performing only read operation.
should i need to use some form of lock which i keep hearing about during i read the sectors.i am using 16 bit computing.

thank you.
0
Comment
Question by:vinayak_j
  • 4
  • 4
  • 2
  • +3
13 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 75 total points
ID: 7064535
If this is for DOS, then no.   DOS is a singletheaded OS and there is no chance of another thread accessing the drive.

If this is for windows....

Well what is it you are writting?  Is this a driver?
0
 
LVL 32

Expert Comment

by:jhance
ID: 7064621
If you are ONLY reading then there should be no need to lock anything.  If you were doing a read/update/write operation then you must lock to be sure that nothing write new data to the sector during the update interval or you will overwrite whatever data was written since you last read it.
0
 
LVL 22

Expert Comment

by:nietod
ID: 7064641
Well, you could potentially read data that was being written to by anoher thread and thus get data that was 1/2 the old value and 1/2 the new and thus--in a sense corrupted.

I'm sure of the context of this, so I'm not sure if that a possiblity in this case or not.
0
 
LVL 32

Expert Comment

by:jhance
ID: 7064748
Not at the sector level.  Since the SMALLEST unit of data that can be written to or read from a hard drive is a sector, and typical hard drives have ONLY one R/W head and cannot do more than one thing at a time, you cannot read a sector that has been 1/2 written.  A sector write operation is indivisible from a system level point of view.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7064765
hi vinayak_j,
Are you getting an error when you use int 21h function 7305h?

If so, what is the error code?
-- Dan
0
 

Author Comment

by:vinayak_j
ID: 7090036
this is for DanRollins i do not get any error.
i am now able to successfully access the drive.sorry for being late.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 49

Expert Comment

by:DanRollins
ID: 7091123
If you have solved the prolem youself, please delete this question.  To do that, please post to Community Support.  Thanks.

-- Dan
0
 
LVL 32

Expert Comment

by:jhance
ID: 7092267
I don't see this as a candidate for deletion.  The question is a legitimate one and has been addressed by experts.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7093138
>>I don't see this as a candidate for deletion
jhance,
Which expert comment could possibly have provided the answer?  There is nothing here but requests for feedback and broad generalities and unrelated chaffe about reading 1/2 sector.

-- Dan
0
 
LVL 32

Expert Comment

by:jhance
ID: 7093153
I stand by my position.  There is no possibility for reading/writing 1/2 a sector.  

From a disk subsystem point of view a sector is indivisible. (i.e. it's an ATOM)

This user asked: "should i need to use some form of lock"

Answer, NO!

I say give the points to nietod.  While he was a bit incomplete (due to lack of information from user) he is, nonetheless, correct.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7093257
Sorry jhance,
On a re-read of the Q, I agree.  neitod answered the posted question fully and correctly.  He deserves credit.
-- Dan
0
 
LVL 11

Expert Comment

by:griessh
ID: 7261749
Dear vinayak_j

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "nietod"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7332912
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now