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.

Google Now Lets Parents Manage Their Kids' Phone Time Remotely

iStock
iStock

Setting screen time limits on teenagers was much easier in the pre-smartphone era. Modern parents often have to choose between taking their kids' phones away or letting them text through family game night—but now Google is offering a different option. Beginning today, September 18, Android phone owners are able to set restrictions on their teens' devices, either by setting time limits, locking their phones remotely, or subjecting app downloads to parental approval, The Verge reports.

These features are rolling out through Family Link, an app Google released in 2017 that lets kids create Google accounts that their parents can access. With the new changes, minors over age 13 can create similar Google accounts, or update their old ones to enable parental controls.

As is the case with Family Link for kids, parents can use Google's software to manage how—and how much—their kids use their phones as well as track their location. The biggest difference with the Family Link apps for teens is that both account holders must consent before parents can start monitoring their kids' phones. And if teens ever decide they want to make their phone activity private, they can choose to turn off the supervision mode. The catch is that doing this will lock them out of their phones for 24 hours and send a notification to their parents.

The new features are now available on all Android phones, and will be coming to Chromebooks soon. Users in the U.S. will also be able to use their Google Assistants to manage their Family Link accounts starting next week.

[h/t The Verge]

AI Is Tackling Yet Another Creative Medium: Improv Comedy

iStock
iStock

AI-generated fan fiction, music videos, and film scripts are often so bad that they’re hilarious. Could an AI program get the same number of laughs if it attempted improv comedy in front of a live audience? As Inverse reports, artificial intelligence researcher Kory Mathewson created an algorithm to find out.

Mathewson, from Canada’s University of Alberta, teamed up with London-based researcher Piotr Mirowski to create a chatbot, A.L.Ex, which stands for Artificial Language Experiment. They fed subtitles from 100,000 films into a neural network in the hope that A.L.Ex would be able to come up with jokes and carry on a conversation with a live human performer. (They also applied a filter to the robot to stop it from saying “politically incorrect” things, and presumably to prevent a disaster akin to Tay, Microsoft’s Twitter bot.)

Once A.L.Ex was sufficiently prepared for the spotlight, a performer interacted with the chatbot (who was given a robot body) on stage in an improv scenario. Audiences were asked to participate in a Turing test: During some scenes, a human backstage was controlling the robot's responses, while in others, A.L.Ex was doing all the work. Audience members were later asked to guess whether the dialogue was coming from the bot or an actual human. The experiment was repeated in three locations: Stockholm, Sweden; London, England; and Edmonton, Canada.

The result? The bot failed to fool humans and pass the Turing test, but it still garnered a few laughs. For one thing, the system was unable to tell complete stories. “If you want to tell a story, humans tend to have to pick up the arc and carry it through, since the Cyborg rarely brings arguably important characters or plot items back,” one of the improv performers wrote, according to a paper that Mathewson and Mirowski uploaded to the preprint platform arXiv [PDF].

Mirowski told The New York Times that the bot is like a “completely drunk comedian” who is only “accidentally funny” on occasion. Fortunately for comedy lovers, machines probably won’t be taking over the stage anytime soon. “We do not think that machines will replace human actors or comedians,” Mathewson told Inverse. “We aim to build new tools and techniques for human storytellers to share their human experience. This work aims to test the development of a new form of medium.”

[h/t Inverse]

SECTIONS

arrow
LIVE SMARTER