407 views

1 Answer

Answer :

A semaphore is called binary semaphore when its value is 0, it is assumed that it has been taken (or accepted) & when its value is 1, it is assumed that it has been released & no task has taken it yet.
An ISR can release the token. A task can release the token as well accept the token or wait for taking the token.

Shared data problem solutions:

One solution is atomic queue operation for solving the shared data problem.
1.Use modifier volatile with a declaration for a variable that returns from the interrupt. This declaration warns the compiler that certain variables can modify because the ISR does not consider the fact that the variable is also shared with a calling function.
2.Use reentrant functions with atomic function instructions in that part of a junction that needs its complete execution before it can be interrupted.
3.Put a shared in a critical queue. A function that requires the value of this variable always deletes it from the queue front, and another function, which inserts the value of this variable. always does so at the queue back.
4.Disable the interrupts before a critical section starts executing & enable the interrupts on its completion it is a powerful drastic option. An interrupt even is of higher priority than the present critical function gets disabled.

Shared-Data Problems
Void Task1 (void)
{
:
vconterErrors(9);
:
}
void Task2 (void)
{
:
vcontErrors(11);
:
}
static int cErrors;

void vconutErrors (int vNewErrors)
{
cErrors += cNewErrors:
}

Fig. Tasks can share code

The above fig shows a bug in the code. Here both task1 and task2 call vcontErrors. This is a perfectly valid thing to do in an RTOS. Any or all of the tasks can share as many subroutines as is convenient.
The difficulty with the program is that because both Task1 and Task2 call vcontErrors and since vcontErrors uses the variable cErrors is now shared by the 2 tasks.
If task1 calls vcontErrors, and if the RTOS then stops Task1 and runs Task2 which then calls vcontErrors, the variable cErrors may get corrupted in just the same way as it would if Task2 were an interrupt routine that had interrupted Task1.

Reentrancy:
Reentrant functions are functions that can be called by more than one task and that will always work correctly, even if the RTOS switches from one task to another in the middle of executing the function.
The 3 rules to decide if a function is reentrant are:
1. A reentrant function may not use variables in a nonatomic way unless they are stored on the stack of the task that called the function or are otherwise the private variables of that task that called the function or are otherwise the private variables of that task.
2. A reentrant function may not call any other functions that are not themselves reentrant.
3. A reentrant function may does not use the hardware in a nonatomic way.

Like 0 like

Please log in or register to answer this question.

Related questions

751 views

Description : What are counting semaphores and resource semaphore?

Last Answer : If a task tries to take the semaphore when the integer is equal to zero, then the task will block. These semaphores are called counting semaphore. Some system offer semaphore that can be ... , but they cannot be used to communicate between two tasks. Such semaphores are called resource semaphore.

1 answer
122 views

Last Answer : Common computation models: Sequential program model Statements, rules for composing statements, semantics for executing them Communicating process model ... Object-oriented model For breaking complex software into simpler, well-defined pieces

1 answer
139 views

Last Answer : Various features of Linux that are used in embedded systems are as follows : Linux is multiuser operating system. Linux is open source and free. Linux can be ... Linux supports handling of errors. Real-time Linux supports the group scheduling functions.

1 answer
186 views

Last Answer : Liquid Crystal Display:-An LCD is a low-cost, low power device capable of displaying text and images. LCD's are extremely common in embedded systems since such system often does not have video monitors ... toggles the enables bit and acts as a delay so that the command can be processed and executed.

1 answer
387 views

Last Answer : The main characteristics of an embedded system are:1. Single functioned2. Tightly constrained3. Reactive and real time1. Single functioned:An embedded system usually executes a specific program repeatedly.Ex. Pager ... computer user. But it doesn't result in a system failure.Ex. Digital camera chip

1 answer
127 views

Description : Define embedded system.

Last Answer : An embedded system is nearly any computing system other than a desktop computer. Embedded systems are hard to define because they cover such a broad range of electronic devices. It has three main components: 1. Hardware 2. Main application software 3. Real time operating system

1 answer
80 views

Description : What is meant by embedded Linux?

Last Answer : Linux is the operating system if we use this operating system in embedded system devices then it is known as embedded Linux. Linux is open source and free.

1 answer
670 views

Last Answer : Shared memory :For sharing of data faster and communication between programs, we use shared memory. Shared memory can be used with multiprocessors and single processors. Means Program ... No resource preemption4. Circular waitIf the four conditions occur simultaneously then the deadlock occurs.

1 answer
229 views

Description : There are three processes P1, P2 and P3 sharing a semaphore for synchronising a variable. Initial value of semaphore is one. Assume that negative value of semaphore tells us how many processes are waiting in queue. Processes access ... The final value of semaphore will be: (1) 0 (2) 1 (3) -1 (4) -2 

Last Answer : Answer: 1

1 answer
0 views

Description : What does AAA’ stands for in Semaphore?

0 answers
4 views

Description : What is a semaphore? 

Last Answer : A resource management, synchronization, and locking tool. 

1 answer
209 views

Description : State the methods of task synchronization. Describe semaphore with suitable example.

Last Answer : The methods of task synchronization are: Semaphore Message queue. Mutual exclusion.  Dead lock. Mailboxes. Message Queues. Semaphores: It is a system of sending message by using flags. Multiple concurrent threads of execution ...   signal(Sem);  }  in process P2  {  wait(Sem);  S2;  }

1 answer
8 views

Description : An intuitive manager could best be described as one who: A)uses scientific problem solving B)eliminates uncertainty in decision making C)searches out facts and data systematically D)uses an orderly approach to gathering information E)uses personal knowledge and experience to make decisions

Last Answer : E)uses personal knowledge and experience to make decisions

1 answer
0 views

Description : Who guides us while solving any problem?

0 answers
187 views

Description : Explain data transfer mechanism in I2C protocol. Compare it with CAN and USB protocol based on bit rate and area of applications.

Last Answer : I2C (Inter-Integrated Circuit): I2C stands for Inter-Integrated Circuit. I2C is a serial protocol. It was developed by Philips Semiconductor. I2C bus have two communication lines. One is serial data ( ... Mbps this is used for lower speed devices. Using USB we can connect upto 127 devices.

1 answer
30 views

Description : The following were the features of the Nation state that emerged in Europe in the 20th century. a. The concept and practices of a modern state with sovereign centralised power developed in Europe. ... identified their nations. Mainly female figures were used to portray the nation. d. None of these

Last Answer : b. Nation state was supposed to be a state where majority of its citizens shared common identify and history.

1 answer
15 views

Description : Firms that truly adopt the marketing concept develop a distinct organisational culture based on a shared set of beliefs that make __________ the pivotal point of the firm's decisions ... beating competitors B)increasing market share C)customers' needs D)marketing implementation E)marketing control

Last Answer : C)customers' needs

1 answer
1 view

Description : Explain what is the Statistical Problem Solving Process.

0 answers
1 view

Description : How did underground railway help in solving housing problem ? -SST 10th

Last Answer : London Underground partially solved the housing crisis by carrying large masses of people to and fro the city.

1 answer
4 views

Description : A transgenic food crop which may help in solving the problem of night blindness in developing countries is (a) Bt soybean (b) Golden rice (c) Flavr Savr tomatoes (d) Starlink maize.

Last Answer : b) Golden rice

1 answer
8 views

Description : Pickup wrong definition 1) Off line - is a system peripheral equipment not controlled by CPU 2) Online - is system in which peripheral equipment is in direct contact with CPU 3) PL/I is the ... /Index 4) Program or routine is a set sequence of instructions given to computer for problem solving

Last Answer : 3) PL/I is the acronym Peripheral Listing /Index

1 answer
20 views

Description : Language is best thought of as Options: A) A biological (instinctive) development B) A system of symbols for effective problem-solving C) A nomenclature for cataloguing experience D) A medium for self-enhancement

Last Answer : C) A nomenclature for cataloguing experience 

1 answer
0 views

Description : How can we improve our problem-solving skills?

Last Answer : Improving problem-solving skills requires practice and learning new techniques. Solutions include learning to analyze problems systematically, seeking out new perspectives, and brainstorming potential solutions.

1 answer
1 view

Description : Why is problem solving skill important for an entrepreneur?

0 answers
0 views

Description : “The role of alcohol in traffic safety has caused the greatest threat to safety”. On the basis of your understanding, suggest any two ways of solving this problem.

0 answers
0 views

Description : Divya loved solving ....... a) problem b) sums c) mysteries

0 answers
1 view

Description : What sort of problem solving do you do every day?

Last Answer : This question could be answered many ways. For me it is dealing with Bipolar. Simply because some days I battle to function. More importantly though, it is the shit my illness causes. Like when I simply ... precious now. I've learned a lot from this illness. Oddly I wouldn't change a thing! :)

1 answer
0 views

Description : Which version of problem-solving method should I choose to keep my self-esteem due to almost-discovered lies?

Last Answer : answer:Which version should you choose? Do what you think is right.

1 answer
3 views

Description : Did you hear anything about the space station having something to do with solving the problem of future radiation meltdowns?

Last Answer : No, the space station could not divert radiation. No possible way it could do that.

1 answer
1 view

Description : How good at problem-solving are you (scenarios inside)?

Last Answer : answer:1. Get off the bus and call for a ride. 2. Hunker down and bust out my emergency kit, light some flares and wait for someone to drive by. A lot of this depends on where you've broken down. The ... for it. No one ever got out of a bad situation by freaking out, you have to think of a solution.

1 answer
4 views

Description : What are some math applications and problem solving practice questions websites are pretty good to use to get ready for the CPT(college placement testing)

Last Answer : I am not familiar with any websites, but Kaplan and Barron both publish excellent test prep books for most college placement tests. These books usually come with cd's with problems and your local public ... public library doesn't, an academic library (local college or high school) might have a copy.

1 answer
1 view

Description : What are the five stages in the Ladder of Problem Solving from "Thinking through Problem Solving"?

Last Answer : answer:http://www.changethis.com/21.ThinkingThrough The five stages: detection, inclination, capability, inquiry, skilled-response, and directed response. I know that's six. Maybe you only use one or the other of the last two?

1 answer
0 views

Description : What's your weirdest approach to problem solving?

Last Answer : Put in an earbud and figure it out as you go

1 answer
1 view

Description : Irrigation is very necessary for solving the food problem. -SST 10th

Last Answer : Agricultural crops are varied. Ample supply of water is required during the period of growth.

1 answer
2 views

Description : The probability of A, B, C solving a problem are 1/3, 2/7 and 3/8 respectively. -Maths 9th

Last Answer : Let E1, E2, E3 be the eventsthat the problem issolved by A, B, C respectively and let p1, p2, p3 be corresponding probabilities. Then,p1 = P(E1) = \(rac{1}{3}\), p2 = P(E2) = \(rac{2}{7}\), p3 = P(E3) = \(rac{3}{8}\) ... }{8}\) = \(rac{25}{168}\) + \(rac{5}{42}\) + \(rac{5}{28}\) = \(rac{25}{56}.\)

1 answer
3 views

Description : A problem in mathematics is given to four students A, B, C and D. Their chances of solving the problem -Maths 9th

Last Answer : Given, P(A) = \(rac{1}{2}\) ⇒ P(\(\bar{A}\)) = P(A not solving the problem) = 1 - \(rac{1}{2}\) = \(rac{1}{2}\)P(B) = \(rac{1}{3}\) ⇒ P(\(\bar{B}\)) = 1 - \(rac{1}{3}\) = \(rac{2}{3}\)P(C) = \ ... 3}{4}\)x \(rac{4}{5}\) = \(rac{1}{5}\)∴ P(problem will be solved) = 1 - \(rac{1}{5}\) = \(rac{4}{5}\).

1 answer
0 views

Description : Problem solving

Last Answer : People crossed the bridge in groups of 2 and 3, Twenty one people crossed, How many groups of 2 were there, How many of 3?

1 answer
5 views

Description : What thinking skills include creative thinking making decisions problem solving seeing things in the mind's eye and which other skill?

Last Answer : Need answer

1 answer
1 view

Description : Is a form of problem solving in which the organism develops a sudden understanding of a problem's solution.?

Last Answer : Need answer

1 answer
4 views

Description : What are the benefits of using mental models during problem solving?

Last Answer : Feel Free to Answer

1 answer
0 views

Description : When did Alan Turing prove that a machine capable of processing a stream 1s and 0s of would be capable of solving any problem.?

Last Answer : 1942

1 answer
1 view

Description : What is the academic discipline that relies most heavily on algorithms for problem solving?

Last Answer : What is the answer ?

1 answer
2 views

Description : In the seven military problem solving process you have identified the problem. what is the next step?

Last Answer : gather information.

1 answer
1 view

Description : Who can utilize technological design as a method to solving problem?

Last Answer : Anyone. C:

1 answer
6 views

Description : In the method of problem-solving, a committee is set up to find a solution. (True/False)

Last Answer : Ans. True

1 answer
8 views

Description : The component of an ICAI (Intelligent Computer Assisted Instruction) presenting information to the student is the? a) Student model b) Problem solving expertise c) Tutoring module d) All of the mentioned

Last Answer : c) Tutoring module

1 answer
6 views

Description : A plan that describe how to take actions in levels of increasing refinement and specificity is ____________ a) Problem solving b) Planning c) Non-hierarchical plan d) Hierarchical plan

Last Answer : d) Hierarchical plan

1 answer
...