/ dev / zero
/ dev / zero denotes a virtual device file on Unix-like operating systems , which returns the requested number of zero bytes (zero characters ) during read access .
/dev/zero
was introduced with SunOS 4.0 in 1987 together with the new VM subsystem. It is not part of the POSIX standard.
Details
When /dev/zero
written to, it behaves like the null device /dev/null
. When the mmap system call is made /dev/zero
, anonymous zeroed pages are made available from the virtual memory pool of the operating system kernel . Many operating systems use this mmap mechanism to make the so -called uninitialized data area available to programs and shared libraries . Many programs use data areas that were generated by an mmap as the basis for shared memory , which is used for communication between several processes .
/dev/zero
use
In the following example, the Unix command creates the dd
file fdisk144.img
that corresponds to the memory image of a 1.44 MB floppy disk (2,880 blocks of 512 bytes) and contains only null characters :
dd if=/dev/zero of=fdisk144.img bs=512 count=2880
If the image then z. For example , if it is formatted with newfs_msdos -F 12 fdisk144.img
(under BSD-Unix such as FreeBSD ; mkfs.msdos
inter alia under Linux ) , the resulting disk image can be used by an emulator or a virtual machine (VM) as a virtual floppy disk with the FAT12 file system.