spin

spin_lock_irqsave vs spin_lock_irq

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: On an SMP machine we must use spin_lock_irqsave and not spin_lock_irq from interrupt context. Why would we want to save the flags (which contain the IF)? Is there another interrupt routine that could interrupt us? 回答1: I am new to the kernel but from what I gather from Robert Love's book "Linux Kernel Development", if interrupts are already disabled on the processor before your code starts locking, when you call spin_unlock_irq you will release the lock in an erroneous manner. If you save the flags and release it with the flags, the function

MOXA Nport 5110A Driver Failed Installation (On Linux Ubuntu 14.04)

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to install MOXA Nport 5110A Driver in my Linux Ubuntu 14.04, but failed miserably. The details about installation process is too long for me to understand where the problem is (and frankly I am still a noob in Linux world). The details is listed below. =============================================================================== Copyright (C) 2002-2012 Moxa Inc. All Rights Reserved. MOXA NPort Server Real TTY Driver V1.18 Installation. System Imformation: Kernel 3.13.0-62-generic; Machine x86_64. ===============================

Is my spin lock implementation correct and optimal?

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm using a spin lock to protect a very small critical section. Contention happens very rarely so a spin lock is more appropriate than a regular mutex. My current code is as follows, and assumes x86 and GCC: volatile int exclusion = 0 ; void lock () { while ( __sync_lock_test_and_set (& exclusion , 1 )) { // Do nothing. This GCC builtin instruction // ensures memory barrier. } } void unlock () { __sync_synchronize (); // Memory barrier. exclusion = 0 ; } So I'm wondering: Is this code correct? Does it correctly ensure mutual

Tkinter 组件详解(十七):Spinbox

匿名 (未验证) 提交于 2019-12-02 23:04:42
版权声明:转载请标明出处 https://blog.csdn.net/qq_41556318/article/details/85596217 Entry 组件 的变体,用于从一些固定的值中选取一个。 何时使用 Spinbox 组件? Entry 组件 。 注意:Spinbox 组件仅支持 Python2.3 和 Tk8.4 以上版本。 用法 Entry 组件 用法非常相似,主要区别是使用 Spinbox 组件,你可以通过范围或者元组指定允许用户输入的内容。 import tkinter as tk root = tk.Tk() w = tk.Spinbox(root, from_=0, to=10) w.pack() root.mainloop() 你还可以通过元组指定允许输入的值: import tkinter as tk root = tk.Tk() w = tk.Spinbox(root, values= ("小新", "风间", "正男", "妮妮", "阿呆")) w.pack() root.mainloop() 参数 Spinbox(master=None, **options) master -- 父组件 **options -- 组件选项,下方表格详细列举了各个选项的具体含义和用法: 选项 含义 activebackground 设置当 Spinbox 处于

Linux设备驱动程序 之 自旋锁

淺唱寂寞╮ 提交于 2019-12-02 19:30:30
概念 自旋锁可以再不能休眠的代码中使用,比如中断处理例程;在正确使用的情况下,自旋锁通常可以提供比信号量更高的性能; 一个自旋锁是一个互斥设备,它只能由两个值,锁定和解锁;通常实现为某个整数值中的单个位;希望获得特定锁的代码测试相关位,如果锁可用,则锁定位被设置,而嗲吗继续进入临界区;相反, 如果锁被其他人获得,则代码进入忙循环并重复检查这个锁,直到该锁可用为止 ;这循环就是自旋锁自旋的部分; 自旋锁在不同的架构上实现有所不同,但是核心概念低于所有系统都都是一样的,当存在某个自旋锁时,等待执行忙循环的处理器做不了任何有用的工作; 自旋锁最初是为了在多处理器系统上使用而设计的,考虑到并发问题, 单处理器工作站在运行可抢占内核时,其行为类似于SMP ;因为抢占,即使不打算在SMP系统上运行自己的嗲吗,我们仍然需要实现正确的锁定; 自旋锁和原子上下文 适用于自旋锁的规则是:任何拥有自旋锁的代码都必须是原子的,它不能休眠;事实上,它不能因为任何原因放弃处理器,除了服务中断以外(某些情况下此时也不能放弃处理器); 内核抢占的情况有自旋锁代码本身处理;任何时候,只要内核代码拥有自旋锁,在相关处理器上的抢占就会被禁止;甚至在单处理器上,也必须以同样的方式禁止抢占以避免竞态; 在拥有锁的时候避免休眠有时候很难做到,休眠可能发生在很多无法预期的地方,当我们编写需要在自旋锁下执行的代码时

windows系统下中安装ispin

ⅰ亾dé卋堺 提交于 2019-12-02 12:33:26
首先是下载spin,直接把github全部内容都下下来之后解压 https://github.com/nimble-code/Spin 接下来是下载cygwin软件根据自己情况下载,附上下载链接 https://www.cygwin.com/ 请记得务必把spin解压在/cygwin/bin/目录下(现在还木有这个目录后面会标注) 务必在此页面选择第二个,因为从网上下载有些内容会出问题,而且有些需要下载安装的会没下 目录自己随便选一个就好,然后在此页面选择第二个点击下一步 随便选一个,亲测选第一个更快 接下来就是找需要下载的东西了点击skip的箭头选择版本,make记得把src的钩打上 所有需要下载的内容如下: binutils 、bison、 byacc flex, gcc-core, gcc-g++ make, mingw64-i686-binutils, mingw64-i686-gcc-core, mingw64-i686-gcc-g++ xinit,xorg-server m4,m4-debuginfo tcl-tk 务必不要落下任何一个 接下来选择第三个把刚刚下下来的所有内容安装上就OK了(最好别改目录) 接下来就是安装目录了把刚刚提到的spin解压到这个目录的bin目录下,并把文件名改为spin1 然后把\cygwin64\bin\Spin1\optional_gui

spin简介以及ispin运行样例

我怕爱的太早我们不能终老 提交于 2019-12-02 12:33:10
工具名称:iSpin 工具的适用范围和应用情况:此工具主要是用Promela编写实现。Promela是一种过程建模语言,其预期用途是验证并行系统的逻辑。给定Promela中的程序,Spin可以通过对建模系统的执行进行随机或迭代仿真来验证模型的正确性,或者可以生成 C 该程序对系统状态空间进行快速详尽的验证。验证程序还可以用于证明系统不变性的正确性,并且可以找到非进度执行周期。最后,它支持线性时间时间约束的验证;要么通过Promela永不声明,要么通过直接制定时间逻辑中的约束条件。可以使用Spin在不同类型的环境假设下验证每个模型。一旦使用Spin建立了模型的正确性,该事实即可用于所有后续模型的构建和验证。 工具使用流程:主要是先通过编写Promela程序,如中间左方白框所示, 通过在 Edit/view 标签中的 Syntax Check , Redundancy Check 之后,通过 Simulate/Replay 标签有 (Re)Run , Stop 和 Rewind 等进行一个随机模拟的运行。 通过查看消息序列图 MSC 能查看各个进程之间通过通道进行的消息交互 ,先给出随机运行序列以及最终结果,具体哪行除了问题。 其中中间左方白框为输入,左下方黑方框为变量数值,中间黑框是运行过程以及问题出错行。 对Spin的补充: Spin采用了偏序规约、on the fly等技术

How to compare two LTLs?

限于喜欢 提交于 2019-12-02 09:04:37
问题 How can I compare two LTLs to see if one can contradict each other? I ask this because I have a hierarchical state machine and LTLs describing the behavior in each state. I need to know if a local LTL can contradict a global LTL. I saw in the Article 'Feature Specification and Automated Conflict Detection' that two LTLs properties f and g are inconsistent iff L(f) intersection L(g) is empty. And this is exactly the model checking question with f as the program and ¬g as the property. Can

How to transform LTL into Automato in Promela - SPIN?

↘锁芯ラ 提交于 2019-12-01 22:51:41
How can I transform LTL into Automata in PROMELA? I know that with the command SPIN -f "ltl x" it is possible transform the LTL into a never claim, but I want the automata of the LTL and not the negation one. It is correct If I negate the LTL before to generate the never claim. Can anyone help me? Patrick Trentin Spin generates the Promela code equivalent to the Buchi Automaton which matches the LTL formula , and envelops it into a never block. From the docs : NAME never - declaration of a temporal claim. SYNTAX never { sequence } DESCRIPTION A never claim can be used to define system behavior