[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

locking hard drive while reading sectors

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
vinayak_j
Asked:
vinayak_j
  • 4
  • 4
  • 2
  • +3
1 Solution
 
nietodCommented:
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
 
jhanceCommented:
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
 
nietodCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
jhanceCommented:
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
 
DanRollinsCommented:
hi vinayak_j,
Are you getting an error when you use int 21h function 7305h?

If so, what is the error code?
-- Dan
0
 
vinayak_jAuthor Commented:
this is for DanRollins i do not get any error.
i am now able to successfully access the drive.sorry for being late.
0
 
DanRollinsCommented:
If you have solved the prolem youself, please delete this question.  To do that, please post to Community Support.  Thanks.

-- Dan
0
 
jhanceCommented:
I don't see this as a candidate for deletion.  The question is a legitimate one and has been addressed by experts.
0
 
DanRollinsCommented:
>>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
 
jhanceCommented:
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
 
DanRollinsCommented:
Sorry jhance,
On a re-read of the Q, I agree.  neitod answered the posted question fully and correctly.  He deserves credit.
-- Dan
0
 
griesshCommented:
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
 
MindphaserCommented:
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 4
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now