Search Results

Search found 112 results on 5 pages for 'semaphore'.

Page 3/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • What is a modern C++ approach to structures containing symbolic constants?

    - by Ken
    enum bool { FALSE = 0, TRUE = 1 }; I'm wondering how to translate this in a modern C++ approach and if there is a well suited container for that; i know that the enum are not really that appreciated, but i can't think about a real alternative in the C++ world. What if would like to associate the execution of a particular method with a state? Ok, this is the part where i will be more verbose. I would like to stress the fact that i'm asking about structures symbolic constants and not about TRUE and FALSE, i'm not that "needy". Suppose that i have a structure that can represent several states with their own constants enum semaphore { GREEN = 0, ORANGE = 1, RED = 2 }; this is C code, now my question is about how to do the same in C++ if there is a better way. My question continue when i ask about the possibility to do something like an automatic triggering when a change of state will occur, for example: int main{ ... semaphore = 1; ... } and without any extra statements this has to trigger a method() just because the semaphore is now orange. I hope that is more clear now.

    Read the article

  • Why can i read dirty rows in MySql

    - by acidzombie24
    I cant believe this, i always throught the below would be concurrency safe. I write to a row in one transaction and i am able to read the dirty value from another transaction/command/connection! Why is this possible (not my main question) isnt this not desired and cause more troubles!?! Anyways, i expected that once i write to a row nothing else will be able to read to the row until the transaction is finished. And at least if the row can be still read that the clean (original) value will be read. (but maybe that would cause problems as well if the transaction doesnt use the newly commited data from the other transaction when it is ran) I would like count to == 11. I thought this would be safe in all variants of sql. What can i do to either 1) Not read the dirty value but clean 2) Have that row be locked until the transaction is finished? static MySqlConnection MakeConn() { string connStr = "server=192.168.126.128;user=root;database=TestDB;port=3306;password=a;"; MySqlConnection conn = new MySqlConnection(connStr); conn.Open(); return conn; } static Semaphore sem1 = new Semaphore(1, 1); static Semaphore sem2 = new Semaphore(1, 1); static void Main2() { Console.WriteLine("Starting Test"); // sem1.WaitOne(); Console.WriteLine("1W"); sem2.WaitOne(); Console.WriteLine("2W"); Thread oThread = new Thread(new ThreadStart(fn2)); oThread.Start(); var conn = MakeConn(); var cmd = new MySqlCommand(@" CREATE TABLE IF NOT EXISTS Persons ( P_Id int NOT NULL, name varchar(255), count int, PRIMARY KEY (P_Id) )", conn); cmd.ExecuteNonQuery(); cmd.CommandText = "delete from Persons; insert into Persons(name, count) VALUES('E', '4');"; cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; var count = (int)cmd.ExecuteScalar(); Console.WriteLine("Finish inserting. v={0}", count); sem2.Release(); Console.WriteLine("2R"); sem1.WaitOne(); Console.WriteLine("1W"); Console.WriteLine("Starting transaction"); using (var tns = conn.BeginTransaction()) { cmd.CommandText = "update Persons set count=count+1"; cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); sem2.Release(); Console.WriteLine("2R"); sem1.WaitOne(); Console.WriteLine("1W"); count += 5; //10 cmd.CommandText = "update Persons set count=" + count.ToString(); cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); tns.Commit(); } Console.WriteLine("finished transaction 1"); sem2.Release(); Console.WriteLine("2R"); sem1.WaitOne(); Console.WriteLine("1W"); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); sem2.Release(); Console.WriteLine("2R"); //sem1.WaitOne(); Console.WriteLine("1W"); } static void fn2() { int count; Console.WriteLine("Starting thread 2"); sem2.WaitOne(); Console.WriteLine("1W"); var conn = MakeConn(); var cmd = new MySqlCommand("", conn); sem1.Release(); Console.WriteLine("1R"); sem2.WaitOne(); Console.WriteLine("2W"); using (var tns = conn.BeginTransaction()) { cmd.CommandText = "update Persons set count=count+1"; cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); sem1.Release(); Console.WriteLine("1R"); sem2.WaitOne(); Console.WriteLine("2W"); tns.Commit(); } Console.WriteLine("finished transaction 2"); sem1.Release(); Console.WriteLine("1R"); sem2.WaitOne(); Console.WriteLine("2W"); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); //should be 11. 4 + 1x2(one each thread) += 5 from first thread == 11 sem1.Release(); Console.WriteLine("1R"); } console Starting Test 1W 2W Starting thread 2 Finish inserting. v=4 2R 1W 1R 1W Starting transaction count is 5 2R 2W count is 6 1R 1W count is 10 finished transaction 1 2R 2W finished transaction 2 1R 1W count is 10 2R 2W count is 10 1R

    Read the article

  • Reflection: take values from an unknown running alpplication

    - by Dr.Lesh
    I'm writing an application that searchs for Semaphore types in the fields of unknown classes in unknown application (passed by user). I made it using Reflection and it worked. Now I want to fill up these semaphores with values, taking them from a running instance of this unknown application. So i took the class with "main" method of this unknown application, made a newInstance, and passed it when invoking the main method to start the application: Class mainClass = getItSomeWhere(); Object instance = mainClass.newInstance(); Method mainMethod = mainClass.getDeclaredMethod("main", new Class[]{String[].class}); mainMethod.invoke(instance, new Object[]{args}); and it worked fine. Now, how can I get the semaphore values, taking them from the classes of this running application, when I only have an instance of the main class? Many thanks for the answers.

    Read the article

  • Optimal strategy to make a C++ hash table, thread safe

    - by Ajeet
    (I am interested in design of implementation NOT a readymade construct that will do it all.) Suppose we have a class HashTable (not hash-map implemented as a tree but hash-table) and say there are eight threads. Suppose read to write ratio is about 100:1 or even better 1000:1. Case A) Only one thread is a writer and others including writer can read from HashTable(they may simply iterate over entire hash table) Case B) All threads are identical and all could read/write. Can someone suggest best strategy to make the class thread safe with following consideration 1. Top priority to least lock contention 2. Second priority to least number of locks My understanding so far is thus : One BIG reader-writer lock(semaphore). Specialize the semaphore so that there could be eight instances writer-resource for case B, where each each writer resource locks one row(or range for that matter). (so i guess 1+8 mutexes) Please let me know if I am thinking on the correct line, and how could we improve on this solution.

    Read the article

  • How to set shmall, shmmax, shmni, etc ... in general and for postgresql

    - by jpic
    I've used the documentation from PostgreSQL to set it for example this config: >>> cat /proc/meminfo MemTotal: 16345480 kB MemFree: 1770128 kB Buffers: 382184 kB Cached: 10432632 kB SwapCached: 0 kB Active: 9228324 kB Inactive: 4621264 kB Active(anon): 7019996 kB Inactive(anon): 548528 kB Active(file): 2208328 kB Inactive(file): 4072736 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 3432 kB Writeback: 0 kB AnonPages: 3034588 kB Mapped: 4243720 kB Shmem: 4533752 kB Slab: 481728 kB SReclaimable: 440712 kB SUnreclaim: 41016 kB KernelStack: 1776 kB PageTables: 39208 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 8172740 kB Committed_AS: 14935216 kB VmallocTotal: 34359738367 kB VmallocUsed: 399340 kB VmallocChunk: 34359334908 kB HardwareCorrupted: 0 kB AnonHugePages: 456704 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 12288 kB DirectMap2M: 16680960 kB >>> ipcs -l ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 4316816 max total shared memory (kbytes) = 4316816 min seg size (bytes) = 1 ------ Semaphore Limits -------- max number of arrays = 128 max semaphores per array = 250 max semaphores system wide = 32000 max ops per semop call = 32 semaphore max value = 32767 ------ Messages Limits -------- max queues system wide = 31918 max size of message (bytes) = 8192 default max size of queue (bytes) = 16384 sysctl.conf extract: kernel.shmall = 1079204 kernel.shmmax = 4420419584 postgresql.conf non defaults: max_connections = 60 # (change requires restart) shared_buffers = 4GB # min 128kB work_mem = 4MB # min 64kB wal_sync_method = open_sync # the default is the first option checkpoint_segments = 16 # in logfile segments, min 1, 16MB each checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0 effective_cache_size = 6GB Is this appropriate ? If not (or not necessarily), in which case would it be appropriate ? We did note nice performance improvements with this config, how would you improve it ? How should kernel memory management parameters be set ? Can anybody explain how to really set them from the ground up ?

    Read the article

  • Synchronizing Asynchronous request handlers in Silverlight environment

    - by Eric Lifka
    For our senior design project my group is making a Silverlight application that utilizes graph theory concepts and stores the data in a database on the back end. We have a situation where we add a link between two nodes in the graph and upon doing so we run analysis to re-categorize our clusters of nodes. The problem is that this re-categorization is quite complex and involves multiple queries and updates to the database so if multiple instances of it run at once it quickly garbles data and breaks (by trying to re-insert already used primary keys). Essentially it's not thread safe, and we're trying to make it safe, and that's where we're failing and need help :). The create link function looks like this: private Semaphore dblock = new Semaphore(1, 1); // This function is on our service reference and gets called // by the client code. public int addNeed(int nodeOne, int nodeTwo) { dblock.WaitOne(); submitNewNeed(createNewNeed(nodeOne, nodeTwo)); verifyClusters(nodeOne, nodeTwo); dblock.Release(); return 0; } private void verifyClusters(int nodeOne, int nodeTwo) { // Run analysis of nodeOne and nodeTwo in graph } All copies of addNeed should wait for the first one that comes in to finish before another can execute. But instead they all seem to be running and conflicting with each other in the verifyClusters method. One solution would be to force our front end calls to be made synchronously. And in fact, when we do that everything works fine, so the code logic isn't broken. But when it's launched our application will be deployed within a business setting and used by internal IT staff (or at least that's the plan) so we'll have the same problem. We can't force all clients to submit data at different times, so we really need to get it synchronized on the back end. Thanks for any help you can give, I'd be glad to supply any additional information that you could need!

    Read the article

  • Annoying Twisted Python problem

    - by Kalmi
    I'm trying to answer the following question out of personal interest: What is the fastest way to send 100,000 HTTP requests in Python? And this is what I have came up so far, but I'm experiencing something very stange. When installSignalHandlers is True, it just hangs. I can see that the DelayedCall instances are in reactor._newTimedCalls, but processResponse never gets called. When installSignalHandlers is False, it throws an error and works. from twisted.internet import reactor from twisted.web.client import Agent from threading import Semaphore, Thread import time concurrent = 100 s = Semaphore(concurrent) reactor.suggestThreadPoolSize(concurrent) t=Thread( target=reactor.run, kwargs={'installSignalHandlers':True}) t.daemon=True t.start() agent = Agent(reactor) def processResponse(response,url): print response.code, url s.release() def processError(response,url): print "error", url s.release() def addTask(url): req = agent.request('HEAD', url) req.addCallback(processResponse, url) req.addErrback(processError, url) for url in open('urllist.txt'): addTask(url.strip()) s.acquire() while s._Semaphore__value!=concurrent: time.sleep(0.1) reactor.stop() And here is the error that it throws when installSignalHandlers is True: (Note: This is the expected behaviour! The question is why it doesn't work when installSignalHandlers is False.) Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 396, in fireEvent DeferredList(beforeResults).addCallback(self._continueFiring) File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 224, in addCallback callbackKeywords=kw) File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 213, in addCallbacks self._runCallbacks() File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 371, in _runCallbacks self.result = callback(self.result, *args, **kw) --- <exception caught here> --- File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 409, in _continueFiring callable(*args, **kwargs) File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 1165, in _reallyStartRunning self._handleSignals() File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 1105, in _handleSignals signal.signal(signal.SIGINT, self.sigInt) exceptions.ValueError: signal only works in main thread What am I doing wrong and what is the right way? I'm new to twisted.

    Read the article

  • reactor not working when reactor.run is not called in the main thread and installSignalHandlers=Fals

    - by Kalmi
    I'm trying to answer the following question out of personal interest: What is the fastest way to send 100,000 HTTP requests in Python? And this is what I have came up so far, but I'm experiencing something very stange. When installSignalHandlers is True, it just hangs. I can see that the DelayedCall instances are in reactor._newTimedCalls, but processResponse never gets called. When installSignalHandlers is False, it throws an error and works. from twisted.internet import reactor from twisted.web.client import Agent from threading import Semaphore, Thread import time concurrent = 100 s = Semaphore(concurrent) reactor.suggestThreadPoolSize(concurrent) t=Thread( target=reactor.run, kwargs={'installSignalHandlers':True}) t.daemon=True t.start() agent = Agent(reactor) def processResponse(response,url): print response.code, url s.release() def processError(response,url): print "error", url s.release() def addTask(url): req = agent.request('HEAD', url) req.addCallback(processResponse, url) req.addErrback(processError, url) for url in open('urllist.txt'): addTask(url.strip()) s.acquire() while s._Semaphore__value!=concurrent: time.sleep(0.1) reactor.stop() And here is the error that it throws when installSignalHandlers is True: (Note: This is the expected behaviour! The question is why it doesn't work when installSignalHandlers is False.) Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 396, in fireEvent DeferredList(beforeResults).addCallback(self._continueFiring) File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 224, in addCallback callbackKeywords=kw) File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 213, in addCallbacks self._runCallbacks() File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 371, in _runCallbacks self.result = callback(self.result, *args, **kw) --- <exception caught here> --- File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 409, in _continueFiring callable(*args, **kwargs) File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 1165, in _reallyStartRunning self._handleSignals() File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 1105, in _handleSignals signal.signal(signal.SIGINT, self.sigInt) exceptions.ValueError: signal only works in main thread What am I doing wrong and what is the right way? I'm new to twisted.

    Read the article

  • How to make a thread that runs at x:00 x:15 x:30 and x:45 do something different at 2:00.

    - by rmarimon
    I have a timer thread that needs to run at a particular moments of the day to do an incremental replication with a database. Right now it runs at the hour, 15 minutes past the hour, 30 minutes past the hour and 45 minutes past the hour. This is the code I have which is working ok: public class TimerRunner implements Runnable { private static final Semaphore lock = new Semaphore(1); private static final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); public static void initialize() { long delay = getDelay(); executor.schedule(new TimerRunner(), delay, TimeUnit.SECONDS); } public static void destroy() { executor.shutdownNow(); } private static long getDelay() { Calendar now = Calendar.getInstance(); long p = 15 * 60; // run at 00, 15, 30 and 45 minutes past the hour long second = now.get(Calendar.MINUTE) * 60 + now.get(Calendar.SECOND); return p - (second % p); } public static void replicate() { if (lock.tryAcquire()) { try { Thread t = new Thread(new Runnable() { public void run() { try { // here is where the magic happens } finally { lock.release(); } } }); t.start(); } catch (Exception e) { lock.release(); } } else { throw new IllegalStateException("already running a replicator"); } } public void run() { try { TimerRunner.replicate(); } finally { long delay = getDelay(); executor.schedule(new TimerRunner(), delay, TimeUnit.SECONDS); } } } This process is started by calling TimerRunner.initialize() when a server starts and calling TimerRunner.destroy(). I have created a full replication process (as opposed to incremental) that I would like to run at a certain moment of the day, say 2:00am. How would change the above code to do this? I think that it should be very simple something like if it is now around 2:00am and it's been a long time since I did the full replication then do it now, but I can't get the if right. Beware that sometimes the replicate process takes way longer to complete. Sometimes beyond the 15 minutes, posing a problem in running at around 2:00am.

    Read the article

  • Stopping work from one thread using another thread

    - by 113483626144458436514
    Not sure if my title is worded well, but whatever :) I have two threads: the main thread with the work that needs to be done, and a worker thread that contains a form with a progress bar and a cancel button. In normal code, it would be the other way around, but I can't do that in this case. When the user clicks the cancel button, a prompt is displayed asking if he wants to really cancel the work. The problem is that work continues on the main thread. I can get the main thread to stop work and such, but I would like for it to stop doing work when he clicks "Yes" on the prompt. Example: // Main thread work starts here t1 = new Thread(new ThreadStart(progressForm_Start)); t1.Start(); // Working for (i = 0; i <= 10000; i++) { semaphore.WaitOne(); if (pBar.Running) bgworker_ProgressChanged(i); semaphore.Release(); if (pBar.IsCancelled) break; } t1.Abort(); // Main thread work ends here // Start progress bar form in another thread void progressForm_Start() { pBar.Status("Starting"); pBar.ShowDialog(); } I could theoretically include a prompt in the cancelWatch() function, but then I would have to do that everywhere I'm implementing this class.

    Read the article

  • mod_rewrite all but two files causing loop

    - by mpounsett
    I'm trying to set up a web site to allow the creation of a semaphore file to close the site. The logic I want to follow is: when the semaphore file exists and the request is not for /style.css or /favicon.icon show the content of /closed.html I have 1 and 3 working, but my exceptions for 2 result in a processing loop when style.css or favicon.ico are requested. This is my most recent attempt: RewriteEngine on RewriteCond %{REQUEST_URI} !^/style.css RewriteCond %{REQUEST_URI} !^/favicon.ico RewriteCond /usr/local/etc/site/closed -f RewriteRule ^.*$ /closed.html [L] This is in a VirtualHost block, not in a Directory. There is no .htaccess file in play. I have also recently tried this, based on an answer I found elsewhere, but with the same (looping) result: RewriteCond %{REQUEST_URI} ^/style.css [OR] RewriteCond %{REQUEST_URI} ^/favicon.ico RewriteRule ^.*$ - [L] RewriteCond /usr/local/etc/site/closed -f RewriteRule ^.*$ /closed.html [L] I expect a request for /style.css or /favicon.ico to fail to match one of the first two rewrite conditions, which should prevent the URI from being rewritten, which should stop the mod_rewrite iteration. However, mod_rewrite seems to think the URI has been rewritten in those cases, and iterates over the rules again (and again, and again). The above works properly in all cases except for style.css or favicon.ico. In those cases I exceed the loop limits. What am I missing here to cause the rewrite iteration to stop when someone requests style.css or favicon.ico? EDIT: Here's a loglevel 9 example of what happens using the first ruleset when a request arrives for /style.css. This is just the first two iterations.. it continues to loop identically until the limit is reached. 2001:4900:1044:0:145f:826e:6436:dc1 - - [29/May/2014:15:29:26 +0000] [host.example/sid#80c1c48b0][rid#80c1db0a0/initial] (2) init rewrite engine with requested uri /style.css 2001:4900:1044:0:145f:826e:6436:dc1 - - [29/May/2014:15:29:26 +0000] [host.example/sid#80c1c48b0][rid#80c1db0a0/initial] (3) applying pattern '^.*$' to uri '/style.css' 2001:4900:1044:0:145f:826e:6436:dc1 - - [29/May/2014:15:29:26 +0000] [host.example/sid#80c1c48b0][rid#80c1db0a0/initial] (4) RewriteCond: input='/style.css' pattern='!^/style.css' => not-matched 2001:4900:1044:0:145f:826e:6436:dc1 - - [29/May/2014:15:29:26 +0000] [host.example/sid#80c1c48b0][rid#80c1db0a0/initial] (1) pass through /style.css 2001:4900:1044:0:145f:826e:6436:dc1 - - [29/May/2014:15:29:26 +0000] [host.example/sid#80c1c48b0][rid#80c1dd0a0/initial] (2) init rewrite engine with requested uri /style.css 2001:4900:1044:0:145f:826e:6436:dc1 - - [29/May/2014:15:29:26 +0000] [host.example/sid#80c1c48b0][rid#80c1dd0a0/initial] (3) applying pattern '^.*$' to uri '/style.css' 2001:4900:1044:0:145f:826e:6436:dc1 - - [29/May/2014:15:29:26 +0000] [host.example/sid#80c1c48b0][rid#80c1dd0a0/initial] (4) RewriteCond: input='/style.css' pattern='!^/style.css' => not-matched 2001:4900:1044:0:145f:826e:6436:dc1 - - [29/May/2014:15:29:26 +0000] [host.example/sid#80c1c48b0][rid#80c1dd0a0/initial] (1) pass through /style.css

    Read the article

  • How to install gspca on ubuntu 12.04?

    - by sam
    I tried to install gspca to run Orite webcam. But I failed to install gspca on ubuntu 12.04 64 bits. It lost a lot of headers,here are my instructions but failed. wget http://mxhaard.free.fr/spca50x/Download/gspcav1-20071224.tar.gz tar zxvf gspcav1-20071224.tar.gz cd gspcav1-20071224/ sudo ./gspca_build sudo touch /usr/src/linux-headers-3.2.0-25-generic/include/linux/config.h sudo mkdir /usr/src/linux-headers-3.2.0-25-generic/include/asm sudo touch /usr/src/linux-headers-3.2.0-25-generic/include/asm/semaphore.h sudo touch /usr/src/linux-headers-3.2.0-25-generic/include/linux/videodev.h sudo touch /usr/src/linux-headers-3.2.0-25-generic/include/linux/smp_lock.h How to solve it? Thank you~

    Read the article

  • Operating systems theory -- using minimum number of semaphores

    - by stackuser
    This situation is prone to deadlock of processes in an operating system and I'd like to solve it with the minimum of semaphores. Basically there are three cooperating processes that all read data from the same input device. Each process, when it gets the input device, must read two consecutive data. I want to use mutual exclusion to do this. Semaphores should be used to synchronize: P1: P2: P3: input(a1,a2) input (b1,b2) input(c1,c2) Y=a1+c1 W=b2+c2 Z=a2+b1 Print (X) X=Z-Y+W The declaration and initialization that I think would work here are: semaphore s=1 sa1 = 0, sa2 = 0, sb1 = 0, sb2 = 0, sc1 = 0, sc2 = 0 I'm sure that any kernel programmers that happen on this can knock this out in a minute or 2. Diagram of cooperating Processes and one input device: It seems like P1 and P2 would start something like: wait(s) input (a1/b1, a2/b2) signal(s)

    Read the article

  • Operating systems -- using minimum number of semaphores

    - by stackuser
    The three cooperating processes all read data from the same input device. Each process, when it gets the input device, must read two consecutive data. I want to use mutual exclusion to do this. The declaration and initialization that I think would work here are: semaphore s=1 sa1 = 0, sa2 = 0, sb1 = 0, sb2 = 0, sc1 = 0, sc2 = 0 I'd like to use semaphores to synchronize the following processes: P1: P2: P3: input(a1,a2) input (b1,b2) input(c1,c2) Y=a1+c1 W=b2+c2 Z=a2+b1 Print (X) X=Z-Y+W I'm wondering how to use the minimum number of semaphores to solve this. Diagram of cooperating Processes and one input device: It seems like P1 and P2 would start something like: wait(s) input (a1/b1, a2/b2) signal(s)

    Read the article

  • Upgraded Ubuntu 12.04 -> 12.10 and Drupal 7 site now get error

    - by Paul B
    I do all my Drupal 7 webdev and today I took advantage to upgrade my local WebDev box O/S to Ubuntu 12.10 from 12.04 and now I get the following errors for all my D7 projects on my localhost WebDev box (Ubuntu 12.10) It was all fine pre Ubuntu 12.04: Error The website encountered an unexpected error. Please try again later. Error message PDOException: SQLSTATE[42000]: Syntax error or access violation: 1286 Unknown storage engine 'InnoDB': SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => variable_init ) in lock_may_be_available() (line 167 of /var/www/jobsdaily/includes/lock.inc). A quick research and look into the phpmyadmin (3.4.11.1) and it seems InnoDB is an issue and when I click on a table to see data I get #1286 - Unknown storage engine 'InnoDB'. I have all my D7 sql backed up, but don't really want to go down the whole 'import' route, since it's 10 months work! Anyone had this issues and can anyone suggest fix ideas? Thanks

    Read the article

  • SLOB: ?????????????

    - by katsumii
    Oracle DB????????????????????????????Introducing SLOB – The Silly Little Oracle Benchmark « Kevin Closson's Blog: Platforms, Databases and StorageSLOB supports testing Oracle logical read (SGA buffer gets) scalingSLOB supports testing physical random single-block reads (db file sequential read)SLOB supports testing random single block writes (DBWR flushing capacity)SLOB supports testing extreme REDO logging I/O????????????????Oracle?????????Swingbench ??????????IPC Semaphore?????C???????????????????Windows???????????Cygwin??????????????????????????????SwingbenchSwingbench can be used to demonstrate and test technologies such as Real Application Clusters, Online table rebuilds, Standby databases, Online backup and recovery etc.???????I/O?????????????????Oracle ORION DownloadsORION (Oracle I/O Calibration Tool) is a standalone tool for calibrating the I/O performance for storage systemsSLOB ??????????????????????????? 

    Read the article

  • Java: thread-safe RandomAccessFile

    - by Folkert van Heusden
    Hi, After some serious googleing I found out that the RandomAccessFile-class is not thread-safe. Now I could use one semaphore to lock all reads and writes but I don't think that performs very well. In theory it should be possible to do multiple reads and one write at a time. How can I do this in Java? Is it possible at all? Thanks!

    Read the article

  • MOSS 2007 SP2 - Error while provisioning SSP.

    - by Tim
    This is a brand new installation I am trying to provision the first SSP for MOSS and I keep getting the following error: (Provisioning failed: A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)) The error also keeps appearing in the Application Event Log as event ID 7888. Google searches tell me its a connection between the Sharepoint server and the SQL server however, this is a production SQL Server which has several databases on it that do not experience any problems. These databases also include the Central Admin and Web Application databases for Sharepoint which are all working fine. Any guidance would be greatly appreciated. Thanks in advance.

    Read the article

  • suddenly cannot mount nfs share from Windows 7

    - by bing
    I recently reinstalled my file server (moved from fedora to Ubuntu server). Now I cannot mount my nfs share from Windows 7, mounting from Mac OSX works fine. In Windows I either keep getting "the semaphore timeout period has expired" or "an unexpected error has occured". Does Ubuntu need some special magic to allow Windows 7 to mount an nfs share? This is my exports file /home/Bing/ 192.168.1.*(rw,async,insecure,no_subtree_check) /home/Bing/mnt/EXTRN2 192.168.1.*(rw,async,insecure,no_subtree_check) /home/Bing/mnt/EXTRN3 192.168.1.*(rw,async,insecure,no_subtree_check)

    Read the article

  • suddenly cannot mount nfs share from windows 7

    - by bing
    I recently reinstalled my file server (moved from fedora to ubuntu server). Now I cannot mount my nfs share from windows 7, mounting from mac osx works fine. In windows I either keep getting "the semaphore timeout period has expired" or "an unexpected error has occured". Does ubuntu need some special magic to allow windows 7 to mount an nfs share? This is my exports file /home/bing/ 192.168.1.*(rw,async,insecure,no_subtree_check) /home/bing/mnt/EXTRN2 192.168.1.*(rw,async,insecure,no_subtree_check) /home/bing/mnt/EXTRN3 192.168.1.*(rw,async,insecure,no_subtree_check)

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >