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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:30:00+00:00 2026-05-24T16:30:00+00:00

Somebody asked me this question: Two processes P1 and P2 are using a shared

  • 0

Somebody asked me this question:

Two processes P1 and P2 are using a shared library (UNIX system).
The shared library has a global variable G1, and a getval( ) and setval( ) function which gets and sets the value of G1.

Here is the sequence of events:

P1:Calls setval(10)  P1:Goes to sleep P2: Calls setval(20) P2:Goes to sleep P1:awake from sleep P1: Calls val=getval( )

Now what will be the value of val? Which P1 receives? Is it 10 or 20?

What will be your answer, with explanation.
Choices are:

  1. val=10, this is because every process executes and has its own address space although multiple processes are using the same shared library. So, although G1 is a global variable, its value will be unique for every process.

  2. P1. receives a value of 20, as the value was altered by process P2 when P1 was asleep.

  3. The value cannot be determined.

  4. You can add any other answer if you wish apart from these 4 choices.

Well, 1. was my answer. Do you agree?

P1 and P2 do not co-operate and are independent processes

  • 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-24T16:30:01+00:00Added an answer on May 24, 2026 at 4:30 pm

    val=10. Indeed, every process and has its (not it’s, “it’s” is “it is”) own address space. The library has no data space by itself.

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

Sidebar

Related Questions

I have looked around here to see if somebody has asked this question before
Somebody advised me to use Entity Framework here when I asked this question: what
I guess this question has been asked a lot around. I know Rails can
I did a search for this question thinking that somebody must have asked it
I'm not sure if this question has been asked before ( searched through SOF
I know this kind of question has been asked many times. Yet I don't
I'm sure this has already been asked, so if somebody can refer me to
I couldn't find this question already being asked on this forum. I am little
another memory management question: I have asked this before, but did not really get
Good afternoon, Somebody asked me a question today and neither did I know the

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.