- shared variables: accessible by everyone in the office
- private variables: can only be accessed by the person who owns them
Things to consider
Want to keep
Partnership for Advanced Computing in Europe (PRACE) online course,
- which variables are shared (stored on the whiteboard) and which are private (written in your own notepad);
- how to divide up the calculation between workers;
- how to ensure that, when workers need to coordinate with each other, they do so correctly;
- how to minimise the number of times workers must coordinate with each other.
- master region: certain calculations are only carried out by one of the workers – a nominated boss worker;
- barrier: everybody waits until all workers have reached a certain point in the calculation; when everyone has reached that point, workers can then proceed;
- locking: if you are working with a variable and don’t want anyone else to touch it, you can lock it. This means that only one worker can access the variable at a time – if the variable is locked by someone else, you have to wait until they unlock it. On a shared whiteboard you could imagine circling a variable to show to everyone else that you have it locked, then erasing the circle when you are finished.
Adding to a VariableOne of our basic operations is to increment a variable, for example to add up the total number of cars that move each iteration. It may not be obvious but, on a computer, adding one to a variable does not comprise a single operation. Using the whiteboard analogy, it has the following stages:
- take a copy of the value on the whiteboard and write it in your notepad (load a value from memory into register);
- add one to the value on your notepad (issue an increment instruction on the register);
- copy the new value back to the whiteboard (store the new value from register to memory).
Our purpose is to transform access to education.
We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.
We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.