Insider Tips: Locks

Competitive Thinking

Article from Issue 50/2005

A genuine multitasking system like Linux runs many processes concurrently. Programs must compete for data access. Assigning locks to files ensures exclusive access and prevents the possibility of data.

Most Linux machines have an MTA, a Mail Transfer Agent. This can be Postfix, Exim or even Sendmail. The MTA either uses a Fetchmail process or TCP to fetch email messages. When the MTA finds a message addressed to the local user, it passes the message on to the Local Delivery Agent (LDA). And the LDA stores the message in a mailbox file, after possibly taking a detour via a filter such as Procmail. If two messages arrive at the same time, the MTA will hand both of them to an LDA process at the same (see Figure 1). Each process will then attempt to write to the same mailbox file, again at the same time. If you are lucky, the messages end up in the right file, but in the wrong order, but you are far more likely to lose a file as the processes overwrite each other’s data.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • ReiserFS Without Big Kernel Lock

    Even though reiserfs belongs to the veterans of journaling filesystems and established ext3 and ext4 as standard Linux filesystems, a new patch serves to markedly improve it.

  • Hypermail

    Hypermail converts email messages to HTML and allows you to group your messages in tidy archives.

  • IMAP spam filter

    We’ll show you a custom solution for moving spam to a separate folder and adding new spam signatures to SpamAssassin.

  • Samba for Clusters

    Samba Version 3.3 and the CTDB lock manager provide full cluster support.

  • Cryptomator

    Make files fit for the cloud with Cryptomator by encrypting content and obscuring the name and size of each file.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More