Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Access Contention Explanation

Status
Not open for further replies.

jani12

Member
Our Advanced Drive Assist System(ADAS) product is based on Two Renesas RH850 / U2A16 Microcontrollers. The programming language is Embedded 'C'.


When register is accessed by multiple interrupts and tasks, perform exclusive control to prevent access contention. When access contention causes no problems (e.g. contention for the same value), describe it.

I understand the first sentence above. Please explain second sentence with at least One example.
 
Thank you for the Wikipedia link. I read the Semaphore (programming) article but it didn't answer my question.

But I think I just realized answer to my question. "contention for the same value" means if task A and task B are writing same value to a register.
 
I'm not sure in what context you want the question answered. maybe what isn't explained or assumed is that "INCREMENT A" or "DECREMENT A" is one instruction completed in one machine cycle. The semaphone concept is very dependent on that happening in one cycle. If the processor gets an interrupt before or an interrupt after the instruction, it doesn't matter.

A multi-core processor may have trouble. It will depend on the archetecture of the machine.

I have no idea if you question is about a class, a project your doing, a homework assignment or what, I learned the semaphone concept in an Operating System class where we had to write an operating system.

The semaphore concept is very dependent on increment happening in one machine cycle.

I believe they mean when two tasks are writing the same value to a register.

if the instuction is INCREMENT A, then two processes can;t write at the same time.

But, if it's

mov A, register
increment register
mov register, A

that's 3 instructions which can be interrupted and the semaphore concept won't work. it MIGHT work if you disabled all interrupts.

there is usually a test first, where a task wants the resource. the task assumes it got the resource. If the value moved by 2 increments, it didn't get the resource and therefore it decrements the value and tries again later.

it's a wierd concept, but in order for it to work, you have to "play computer" with two tasks and pretend your being interrupted fter every instruction by another process that wants the resource.

Example:

two processes want to use the disc controller to fetch a different block.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top