• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can this code harm our harddisk  RSS feed

 
Salman Mushtaq
Greenhorn
Posts: 27
Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ! hope you all are fine !
Today i make a file that do nothing but write a file in C: drive infinite time ,,,, through

while(true)
{
...
....
.....
} etc . . .

can this file can harm our hard disk ,,,, ?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vague questions usually get vague answers. I would say that with such little information, the best answer you can get is "possibly".
 
drac yang
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i don't think even constantly writing to the disk would harm it(under limited time control), the disk is designed for that originally.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
drac yang wrote:i don't think even constantly writing to the disk would harm it(under limited time control), the disk is designed for that originally.

true...but with such vague specs ("infinite time"), who can really say?

Also, "harm disk" is somewhat vague...how do you define harm? if you fill it up to 100% (or even get close), the system could degrade and become unusable...which by some definitions of 'harm' would be 'yes'.

My larger point is that it is not clear what the OP is really asking.
 
Campbell Ritchie
Marshal
Posts: 56541
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends whether the writer for the file is in overwrite mode or append mode. If it is in append mode it will continue writing and enlarge the file until there is no more available space and then suffer an Exception. If it is in overwrite mode it will write repeatedly to different parts of the hard drive, causing excessive use of the bearings, etc., and possibly obscuring deleted files which have not yet been overwritten.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!