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 8331737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:30:28+00:00 2026-06-09T02:30:28+00:00

OS : FreeBSD 8.2 on Oracle VM Virtual Box I am trying to test

  • 0

OS : FreeBSD 8.2 on Oracle VM Virtual Box

I am trying to test that a process attempting to acquire a read lock will be blocked until it is able to acquire it. After initializing rw_lock in Process #1 and locking the lock as a writer I create a second process which attempts to acquire the lock as a reader using blocking rw_rlock(). What I am shooting for is for process #2 to be blocked until process #1 releases Write lock so I am attempting to use pause to insure that process #2 has enough time to be scheduled. However this same pause somehow crashes the system in this scenario since if it is removed the program runs fine. If I replace the pause with a busy loop in Process #1, Process #2 does not get scheduled until Process #1 finishes so it ruins the point of the test. DELAY() also does not allow Process #2 to be scheduled. Any pointers would be appreciated.

Process #1:

static void test_rw_rlock(void)
{ 
    const int seconds = 1;
    rw_init(pResourceLock, "RWLock");
    rw_wlock(pResourceLock);
    kproc_create(&use_rw_rlock, NULL, NULL, 0, 0, "use_rw_rlock()");
    pause("---", hz * seconds);
    rw_wunlock(pResourceLock);
    rw_destroy(pResourceLock);
}

Process #2 :

static void use_rw_rlock(void* arg)
{
    rw_rlock(pResourceLock);
    rw_unlock(pResourceLock);
    kproc_exit(0);
}
  • 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-09T02:30:29+00:00Added an answer on June 9, 2026 at 2:30 am

    Sleeping while hold a rw lock is a no-no.

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

Sidebar

Related Questions

I am going to have a daemon that will run on a FreeBSD server,
i'm trying to write a for loop that executes 2 scripts on FreeBSD. I
First steps in FreeBSD: trying to run my installation script. Fast help needed: #
Trying to run my program in FreeBSD OS, I have the following results: $
So I installed python on my FreeBSD box with these commans: #portsnap fetch #portsnap
I have installed PostgreSQL on my FreeBSD 8.2 box. How can I open the
So I have installed Django on my FreeBSD 8.2 box like this: pip install
I have installed Emacs on my FreeBSD 8.2 box. Everything works fine but I
I'm trying to configure Apache 2.2 from ports (in FreeBSD). I've written my own
I am running a FreeBSD server and I have been sent a warning that

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.