Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8884351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:02:37+00:00 2026-06-14T21:02:37+00:00

Regarding that thread: bash flock: exit if can't acquire lock I’ll appreciate if someone

  • 0

Regarding that thread:
bash flock: exit if can't acquire lock

I’ll appreciate if someone can explain to me what does the ‘200’ stand for.

I’ve read about flock and it seems that 200 if to specify a File Descriptor, but what is so good about this number?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:02:38+00:00Added an answer on June 14, 2026 at 9:02 pm

    Theres nothing special about the number 200. It just happens to be the example used in the man page of the flock command; and it happens to be a large number, so it’s unlikely to conflict with the the file descriptor of any other file you open during your script.

    In your comment, you ask about:

    ( 
      flock -e 200
      echo "In critical section"
      sleep 5 
    ) 200>/tmp/blah.lockfile 
    echo "After critical section"
    

    The parentheses () create a subshell; a new process, separate from the parent process. The 200>/tmp/blah.lockfile causes that process to open up /tmp/blah.lockfile for writing, on file descriptor 200. The commands inside the parentheses are executed within that shell.

    flock -e 200 obtains an exclusive lock on the file pointed to by file descriptor 200. An exclusive lock means that anyone else who tries to obtain a lock on that file, either exclusive or shared, will block (wait) until this lock has been relinquished, or fail if they hit a timeout or asked not to block. So during the remainder of the body of the subshell (the echo and sleep commands), the lock will be held by that subshell, and no one else can obtain that lock. Once the subshell finishes, the file will be closed and lock relinquished.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I remember reading that static variables declared inside methods is not thread-safe. (See What
It's clear from reading through threads that I can call a PHP function using
A few questions here, regarding letcc that is used in The Seasoned Schemer. (define
This is regarding a project that concerns detection of text in an image using
I have a very basic doubt regarding the method that gets executed when app
I have some questions regarding the following css that I found: html, body {
Regarding: http://code.google.com/chrome/extensions/idle.html Is thresholdSeconds : 1) insisting that the callback is only called if
I have two Years experience in C# programming i have a question regarding thread
I have a general question regarding synchronized List. Lets say that in the constructor
I have a query regarding how delegates work. My understanding was that delegates take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.