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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:07:03+00:00 2026-05-29T21:07:03+00:00

I have a homework problem that I really don’t know how to start. Here

  • 0

I have a homework problem that I really don’t know how to start.

Here is the question:
“This problem makes use of the new synchronization primitive called the ReaderWriterAppender semaphore. The same rules apply with respect to readers and writers as with ReaderWriter semaphore, with the addition of these new rules for an appender:

1) No more than one appender can have the semaphore at any given time.
2) An appender and write cannot own the semaphore at the same time
3) Reads can take place during an append”

I need to implement it on my own.

There is a structure given

typedef struct {
   //structure here
} rwasem_t;

void rwalock_init(rwasem_t * rwa) {

}

void rwa_read_lock(rwasem_t * rwa) {

}

void rwa_write_lock(rwasem_t * rwa) {

}

void rwa_append_lock(rwasem_t * rwa) {

}

void rwa_append_unlock(rwasem_t * rwa) {

}

The problem is, I don’t know how to approach the problem. I know what reader writer semaphore is, I know how to use them, and I have used them before. But I don’t know how to implement them. They don’t even tell me if I can use an API or anything. Basically, “implement it”

Thanks in advance,
Gasim

  • 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-05-29T21:07:05+00:00Added an answer on May 29, 2026 at 9:07 pm

    Some hints:

    1. What is the different of appender and read?

    2. What if you just use a read lock for appender? Name one case they are different.

    3. Can I have add one more lock in the appender case to prevent the case in (2)?

    Pseudo code:

    ReadWriteLock lock_a, lock_b;
    
    void rwa_read_lock(rwasem_t * rwa) {
        lock_a.do_somethingA();
        lock_b.do_somethingB();   // is this needed?
    }
    
    void rwa_write_lock(rwasem_t * rwa) {
        lock_a.do_somethingC();
        lock_b.do_somethingD();   // is this needed?
    }
    
    void rwa_append_lock(rwasem_t * rwa) {
        lock_a.do_somethingE();
        lock_b.do_somethingF();   // is this needed?
    }
    

    what is “do_somethingX()” ?

    Is the order of locking important? If yes, what is the correct order?

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

Sidebar

Related Questions

This is a homework problem that I have. I have been doing some research
Okay, so I have another question on a prolog homework problem I am struggling
I am stumped on this homework problem. I think I have the right answer
I have a homework problem where I have to make an inheritance program that
(this is indirectly a part of a much larger homework assignment) I have something
Full disclaimer: this is not really a homework, but I tagged it as such
This IS NOT a Homework question! While building my current student database project I
I'm working on a problem which we have to use semaphores to solve. I
I have a program that solves the weighted interval scheduling problem using dynamic programming
The N-Queens Problem: This problem states that given a chess board of size N

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.