Solved

locking hard drive while reading sectors

Posted on 2002-06-08
13
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

737 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