Synchronization (computer science)
过程同步、数据同步。
In computer science, synchronization refers to one of two distinct but related concepts: synchronization of processes, and synchronization of data. Process synchronization refers to the idea that multiple processes are to join up or handshake at a certain point, in order to reach an agreement or commit to a certain sequence of action. Data synchronization refers to the idea of keeping multiple copies of a dataset in coherence with one another, or to maintain data integrity. Process synchronization primitives are commonly used to implement data synchronization.
The need for synchronization does not arise merely in multi-processor systems but for any kind of concurrent processes; even in single processor systems. Mentioned below are some of the main needs for synchronization:
Forks and Joins: When a job arrives at a fork point, it is split into N sub-jobs which are then serviced by n tasks. After being serviced, each sub-job waits until all other sub-jobs are done processing. Then, they are joined again and leave the system. Thus, in parallel programming, we require synchronization as all the parallel processes wait for several other processes to occur.
Producer-Consumer: In a producer-consumer relationship, the consumer process is dependent on the producer process till the necessary data has been produced.
Exclusive use resources: When multiple processes are dependent on a resource and they need to access it at the same time the operating system needs to ensure that only one processor accesses it at a given point in time.This reduces concurrency.
Classic problems of synchronization[edit]
The following are some classic problems of synchronization:
- The Producer–Consumer Problem (also called The Bounded Buffer Problem);
- The Readers–Writers Problem;
- The Dining Philosophers Problem.
These problems are used to test nearly every newly proposed synchronization scheme or primitive.
Synchronization in Linux[edit]
Linux provides:
- semaphores;
- spinlock;
- barriers
- mutex
- readers–writer locks, for the longer section of codes which are accessed very frequently but don't change very often.
- Read-copy-update (RCU) [12]
Enabling and disabling of kernel preemption replaced spinlocks on uniprocessor systems. Prior to kernel version 2.6, Linux disabled interrupt to implement short critical sections. Since version 2.6 and later, Linux is fully preemptive.
Synchronization in Solaris[edit]
Solaris provides:
- semaphores;
- condition variables;
- adaptive mutexes, binary semaphores that are implemented differently depending upon the conditions;
- readers–writer locks:
- turnstiles, queue of threads which are waiting on acquired lock.[13]
https://en.wikipedia.org/wiki/Synchronization_(computer_science)
Synchronization (computer science)的更多相关文章
- Discovering the Computer Science Behind Postgres Indexes
This is the last in a series of Postgres posts that Pat Shaughnessy wrote based on his presentation ...
- [转载] A set of top Computer Science blogs
This started out as a list of top Computer Science blogs, but it more closely resembles a set: the o ...
- Computer Science Theory for the Information Age-4: 一些机器学习算法的简介
一些机器学习算法的简介 本节开始,介绍<Computer Science Theory for the Information Age>一书中第六章(这里先暂时跳过第三章),主要涉及学习以 ...
- Computer Science Theory for the Information Age-1: 高维空间中的球体
高维空间中的球体 注:此系列随笔是我在阅读图灵奖获得者John Hopcroft的最新书籍<Computer Science Theory for the Information Age> ...
- Intro to Computer Science Class Online (CS101) - Udacity
Intro to Computer Science Class Online (CS101) - Udacity Building a Search Engine
- MIT Introduction to Computer Science and Programming (Lesson one )
MIT Introduction to Computer Science and Programming (Lesson one ) 这篇文是记载 MIT 计算机科学及编程导论 第一集 的笔记 Les ...
- CSCI 1100 — Computer Science 1 Homework
CSCI 1100 — Computer Science 1 Homework 8CS1 Multiverse: ClassesOverviewThis homework is worth 100 p ...
- How do you explain Machine Learning and Data Mining to non Computer Science people?
How do you explain Machine Learning and Data Mining to non Computer Science people? Pararth Shah, ...
- Mathematics for Computer Science (Eric Lehman / F Thomson Leighton / Albert R Meyer 著)
I Proofs1 What is a Proof?2 The Well Ordering Principle3 Logical Formulas4 Mathematical Data Types5 ...
随机推荐
- VSCode (Code) 技法
本人使用插件推荐 indent-rainbow https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow B ...
- java和android文件加密小结
最近遇到一个文件加密的问题,自己读写的,安全性虽然还可以,但是速度慢,影响体验. Cipher虽然速度相当快,但是android和java有某些api存在不兼容: 问题解决: 方法引用自:https: ...
- 反射另一个app中的View
FrameLayout fl = (FrameLayout) findViewById(R.id.content); View v = null; try { Context context = cr ...
- C语言-实现整数倒序输出
Action() { //实现一个3位数的倒序输出(123输出321) int n; int m=321; n=fun_mod(m,n); lr_output_message("%d&quo ...
- 51nod 237 最大公约数之和 V3 杜教筛
Code: #include <bits/stdc++.h> #include <tr1/unordered_map> #define setIO(s) freopen(s&q ...
- linux下安装Tomcat和java jdk
1:上传jdk的gz文件到linux’系统 2:解压缩这个文件 tar –zxvf 文件名.tar.gz –C 指定目录 比如我这里解压到 /root/apps/jdk tar –zxvf jd ...
- myeclipse的git插件安装
首先需要一个myeclies的Git插件EGit 点击下载5.0.1 官方网站
- 2019-03-20 Python爬取需要登录的有验证码的网站
当你向验证码发起请求的时候,就有session了,记录下这次session 因为每当你请求一次验证码 或者 请求一次登录首页,验证码都在变动 验证码的链接可能不是固定的,可能需要GET/POST请求, ...
- [luogu] P4364 [九省联考2018]IIIDX(贪心)
P4364 [九省联考2018]IIIDX 题目背景 Osu 听过没?那是Konano 最喜欢的一款音乐游戏,而他的梦想就是有一天自己也能做个独特酷炫的音乐游戏.现在,他在世界知名游戏公司KONMAI ...
- Spring中使用Quartz之MethodInvokingJobDetailFactoryBean配置任务
Quartz是一个强大的企业级任务调度框架,Spring中继承并简化了Quartz. Spring中使用Quartz的3种方法(MethodInvokingJobDetailFactoryBean,i ...