473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Re: atomic section in code

Fredrik Lundh <fredr...ware.comwrote:
>sounds like he wants/needs non-cooperative, mandatory locking.
Could one get there using ctypes to disable interrupts?

Cross Platform?

I can think of lots of hassles, starting with permissions
to use the privileged instructions.

- Hendrik

Sep 6 '08 #1
2 940
"Hendrik van Rooyen" <ma**@microcorp.co.zawrote:
>
Fredrik Lundh <fredr...ware.comwrote:
>>sounds like he wants/needs non-cooperative, mandatory locking.
More accurately, he THINKS he wants/needs mandatory locking. We need to
find out what he's really trying to accomplish before we can suggest
something that is actually achievable.
>Could one get there using ctypes to disable interrupts?
No. That can't be done in user mode in any operating system where Python
runs. Even in kernel mode, it's not reliable, because disabling interrupts
only affects one core.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Sep 7 '08 #2
Hendrik van Rooyen schrieb:
Fredrik Lundh <fredr...ware.comwrote:
>sounds like he wants/needs non-cooperative, mandatory locking.

Could one get there using ctypes to disable interrupts?
Not as such, ctypes can't execute arbitrary machine code. But of course
you can create a C-lib that does what you want (IF it can be done, that
is..), and wrap that.
Cross Platform?
Certainly not.
I can think of lots of hassles, starting with permissions
to use the privileged instructions.

I don't think there is a chance for this without major system tinkering.
Under Linux, you could create a real time thread so highly prioritized
that it won't yield any time to any other scheduler. And in a
kernel-module, you can call cli (or whatever the needed call is). But
this will most probably break your system.

diez
Sep 7 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul Moore | last post by:
I can't find anything which spells this out in the manuals. I guess that, at some level, the answer is "a single bytecode operation", but I'm not sure that explains it for me. This thought was...
8
by: Glenn Kasten | last post by:
I am wondering which operations in Python are guaranteed to be atomic in the presence of multi-threading. In particular, are assignment and reading of a dictionary entry atomic? For example,...
42
by: Shayan | last post by:
Is there a boolean flag that can be set atomically without needing to wrap it in a mutex? This flag will be checked constantly by multiple threads so I don't really want to deal with the overhead...
5
by: Pegboy | last post by:
What does it mean to make a function atomic? Something I read on it wasn't very clear, but made me think that I needed to disable interrupts for that function. Whether that's the case or not,...
6
by: blackstreetcat | last post by:
consider this code : int i; //gobal var Thread1: i=some value; Thread2: if (i==2) dosomething(); else dosomethingelse();
3
by: Ole Nielsby | last post by:
I need to implement reference counting in a class hierarch, in a thread safe manner. (The classes are umanaged but I might want to compile them with the /clr option.) Some of the objects - atoms...
5
by: Ark | last post by:
Consider static T foo; .............. T get_foo(void) { return foo; } In a multi-threaded (or -tasked) environment, I need to ensure that I get_foo() grabs T atomically (e.g. is not...
9
by: Dave Stallard | last post by:
Pardon if this is the wrong newsgroup for this question, and/or if this question is naive. I have a multi-threaded Windows application in which certain variables/object fields are shared: one...
2
by: Freedom fighter | last post by:
Hello, Is a singleton class the same as an atomic class? I know that a singleton class can only be instantiated once, but does that concept apply to an atomic class? Thank you.
6
by: Ahmad Humayun | last post by:
Hi there, I need to create an atomic section in Python code i.e. there is no context switch to any other thread during the running of that piece of code. Would would do the trick? thanks,
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.