CLOSE
iStock
iStock

Does Safely Ejecting From a USB Port Actually Do Anything?

iStock
iStock

Does safely ejecting from a USB port actually do anything?

Phillip Remaker:

Is there any harm to be incurred by just pulling a flash drive out? Why do we need safe removal at all?

Historically, operating systems (OS) treat disks as objects that can be trusted not to change state suddenly. When reading or writing files, the OS expects the files to remain accessible and not suddenly disappear in mid-read or mid-write. If a file is open, a program reading the file expects to be able to return to it and continue reading. Similarly, write commands may be dispatched to a writing subroutine and forgotten by the main program. If a drive disappears between the time the subroutine is called and the data is written to disk, that data is lost forever.

In ye olde days, there were formal processes to physically "mount" and "unmount" storage media, and the physical act of mounting a tape or a disk pack triggered some mechanical switch to detect the presence or absence of media. Once the mechanism was engaged, the software could start to use the media (a "soft mount"). Some media even had mechanical interlock to prevent media from being ejected or removed until the software processes using the media released the lock.

The Macintosh floppy and optical disk provide more modern examples of an interlocked physical and soft mount. One could only eject media through a software command, but that command might fail if some program was holding a file open on the medium. 

Enter USB connected storage. There is no mechanical interlock in a USB connection to coordinate the hard and soft mount. The user can decide to rip the disk out from under the operating system at any time, and endure all manner of programs freaking out about the sudden loss of media. "Hey! I was using that!" Symptoms could include: Lost data, corrupted file systems, crashing programs, or hanging computers requiring a reboot. A safe removal executes the "soft unmount" needed to prevent any unexpected Bad Things that may happen if a program loses its access to media.

A safe removal does a few things:

  • It flushes all active writes to disk.
  • It alerts all programs (that know how to be alerted) that the disk is going away, and to take appropriate action.
  • It alerts the user when programs have failed to take action, and still are holding files open.

You can remove a disk at any time, but you are at the mercy of how well programs using the disk cope with the sudden disappearance of that disk.

In the modern computer, many steps have been taken to defend against the capricious and careless removal of media. For example, Windows introduced a feature called "Optimize for Quick Removal," which makes sure data is written quickly instead of batched up and written efficiently. 

It is very hard to get people to change habits. If you are doing exclusively reads on a media, safe removal is probably not needed. If you are doing writes, you are probably OK to skip safe removal if you haven't written recently and you aren't doing something silly like indexing that disk.

As a good friend of mine once said: "Life is too short to safely eject the disk."

However, safe removal does a number of important things and is, in fact, the only assuredly safe way to remove a disk. You probably don't need it most of the time, but it is a good habit to have since data loss sucks.

This post originally appeared on Quora. Click here to view.

nextArticle.image_alt|e
The Long Now Foundation, Vimeo
arrow
technology
Jeff Bezos Is Helping to Build a Clock Meant to Keep Time for 10,000 Years
The Long Now Foundation, Vimeo
The Long Now Foundation, Vimeo

Few human inventions are meant to last hundreds of years, much less thousands. But the 10,000 Year Clock is designed to keep accurate time for millennia. First proposed in 1989, the long-lasting timepiece is finally being installed inside a mountain in western Texas, according to CNET.

The organization building the clock, the Long Now Foundation, wanted to create a tribute to thinking about the future. Founded by computer scientist Danny Hillis and Whole Earth Catalog publisher Stewart Brand, the group boasts famous members like musician Brian Eno and numerous Silicon Valley heavyweights. Amazon founder Jeff Bezos is putting up the $42 million necessary to complete the project, writing that “it's a special Clock, designed to be a symbol, an icon for long-term thinking."

Measuring 500 feet tall when it's completed, the clock will run on thermal power and synchronize each day at solar noon. Every day, a “chime generator” will come up with a different sequence of rings, never repeating a sequence day to day. On specific anniversaries—one year, 10 years, 100 years, 1000 years, 10,000 years—it will animate a mechanical system within one of five rooms carved into the mountain. On the first anniversary, for instance, the clock will animate an orrery, a model of the solar system. Since they don’t expect to be alive for many of the future anniversaries, the clock’s creators won't determine animations for 100, 1000, or 10,000 years—that'll be left up to future generations. (To give you an idea of just how far away 10,000 years is, in 8000 B.C.E., humans had just started to domesticate cows for the first time.)

Though you can sign up to be notified when the clock is finished, it won’t be easy to see it up close. The nearest airport is several hours’ drive away, and the mountain is 2000 feet above the valley floor. So you may have to be content with seeing it virtually in the video below.

Clock of the Long Now - Installation Begins from The Long Now Foundation on Vimeo.

[h/t CNET]

nextArticle.image_alt|e
Tynker
arrow
technology
Barbie Is Now Giving Coding Lessons
Tynker
Tynker

Mattel wants to help 10 million kids learn to code by 2020, and the toy giant is enlisting one of its most career-focused assets: Barbie. According to Engadget, Mattel is working with the coding education company Tynker to make seven Barbie-themed computer programming lessons.

Barbie has been a pilot, an architect, the president, and a computer engineer, so there may be no better character to teach kids the joys of coding. The lessons, arriving in summer 2018, will be designed for youngsters in kindergarten and up, and will teach Barbie-lovers more than just how to make apps. They’ll use Barbie’s many careers—which also included veterinarian, robotics engineer, and astronaut—as a way to guide kids through programming concepts.

An illustration depicts Barbie and her friends surrounded by cats and dogs and reads 'Barbie: Pet Vet.'

A screenshot of a Barbie coding lesson features a vet's office full of pets.

There are plenty of new initiatives that aim to teach kids how to code, from a Fisher-Price caterpillar toy to online games featuring Rey from Star Wars. This is the third partnership between Mattel and Tynker, who have already produced programming lessons using Hot Wheels and Monster High.

Kindergarten may seem a little soon to set kids on a career path as a computer programmer, but coding has been called “the most important job skill of the future,” and you don’t need to work for Google or Facebook to make learning it worthwhile. Coding can give you a leg up in applying for jobs in healthcare, finance, and other careers outside of Silicon Valley. More importantly for kids, coding games are fun. Who wouldn’t want to play Robotics Engineer Barbie?

[h/t Engadget]

All images by Tynker

SECTIONS

arrow
LIVE SMARTER
More from mental floss studios