Solved

locking hard drive while reading sectors

Posted on 2002-06-08
13
199 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
this is for DanRollins i do not get any error.
i am now able to successfully access the drive.sorry for being late.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
Comment Utility
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
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

762 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

6 Experts available now in Live!

Get 1:1 Help Now