UnKnown Error
mathematician1975
c++ linux ubuntu 2014-2-17 2:40:00
This question may seem blindingly obvious and I realise I am putting myself up for a large number of downvotes but I am very new to Linux dev and have only been working on it for a while. I have been writing an application on ubuntu 12.04 (kernel 3.2.0) in C++ then copying this via scp to an ubuntu 8.04 (kernel 2.6.30) installation on another device. I have been noticing some very strange behaviour that I simply cannot explain. I have naively assumed that I can run this executable on a previous
YumYumYum
java linux fedora openjdk archlinux 2014-2-17 2:24:27
I have a simple player i am using third party libraries. Exactly the same code is working in my Fedora desktop. But when i am using exactly the same code in Archlinux it does not work to do main.replay();What is causing it?public static void play(String gsttest) {try {gst.play();gst.getBus().connect(new Bus.EOS() {public void endOfStream(GObject source) {//_7————-_7main.replay(); //<< never getting executed in Archlinux //_7————_7 but Fedora it runs without any problem
Andrei
c# windows linux mono 2014-2-17 2:11:58
In what measure is developing with mono cross-platform? How do I compile for Windows (in Linux), how do I run things in Linux (because there is no .NET JIT compiler)?So what are the particularities of developing with Mono? What are the advantages over developing with Visual Studio (except cross-platform thinghie)?
Dave Powell
c++ linux solaris binary-compatibility 2014-2-17 0:23:19
if i have code compiled under Solaris 8 and 10 and now have a vendor that wants to use my bin/exe under Linux. Could there be compatibility issues? I am pretty sure i would need to compile/link under Linux OS for it to work 100% but i just wanted to know if someone can give me the breakdown as to why it would not work on Linux even though the exe has everything and there is nothing dynamic about it, as in it should not need anything further to run it. Unless we talking runtime libs, that if the
PaulDaviesC
linux memory c function 2014-2-16 22:57:28
I wrote a simple program as below and straced it.#include<stdio.h> int foo(int i) {int k=9;if(i==10)return 1;elsefoo(++i);open(“1”,1); } int main() {foo(1); }My intention in doing so was to checkout how is memory allocated for the variables (int k in this case) in a function on a stack. I used an open system call as a marker. The output of strace was as below:execve(“./a.out”, [“./a.out”], [/* 25 vars */]) = 0 brk(0) = 0x8653000 access(“/etc/ld.so.nohwcap”,
Colin747
java linux find command runtime 2014-2-16 20:16:09
I’m trying to run the following command using Java runtime:find /home/Alison/workspace/FunctionalTestFramework/src/com/q1labs/qa/selenium/screens -type d | awk -F/ ‘NF <= old_NF {print prev} {old_NF=NF; prev=$0} END {print $0}’The command works fine when entered directly into a Terminal but when ran in the following function it gives the following error:find: paths must precede expression: | Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path…] [expression
Sam Jarman
linux bash shell jenkins zsh 2014-2-16 19:21:09
So I’ve come across a few things now that seem to just not work right in the jenkins ‘Execute shell’ stage of a build. These works fine when logged in as the same user on the same machine when typing into bash/zsh/terminal. Is there some setting somewhere to make these match exactly, in terms of permissions, output etc… seems like Jenkins is in some sort of weird sandbox and its really frustrating. A few things that have tripped so far is ruby commands likebundle exec nanoc compileand cap depl
Rell3oT
c linux binary x86 2014-2-16 19:10:31
I’m curious why the Procedure Linkage Table exists. What purpose does it serve? Couldn’t the assembly call the global offset table directly? What advantage does calling the PLT have over calling the Global Offset Table?The whole process is still kind of confusing to me and I’m trying to figure out the in’s and out’s of dynamic linking so any help would be appreciated.
sethu
python linux process arguments 2014-2-16 19:07:08
I am trying to write a script for controling cpu usage of a VM n KVM using cpulimit. With cpulimit i can limit the cpu usage of a VM with pid say 2112 by : ./cpulimit -p 2112 -l 50. I want to write a script which can open an interface setcpu (vm_pid,limit)Which can be called any number of times and I shud overwrite the existing limit. I can overwrite the existing limit by just adding the limit value as a runtime argument for the running cpulimit process. Like subprocess.Popen(…, stdin=subproce
brandstaetter
java windows linux awt 2014-2-16 16:36:51
I have some code (unfortunately not written by me, or else I would know where to start looking for solutions) that draws some line graphs. When I run the code on my Windows machine and on the Linux machine, I get different results: on the Linux machine, the border around the legend is drawn with less height, resulting in some ugly problems when there are more than 3 items in the legend.Is there some known difference when using int getHeight(Graphics2D g, String text) {Rectangle2D bounds = g.getF
David Lin
objective-c synchronization 2014-2-14 1:34:57
Does @synchronized not use “lock” and “unlock” to achieve mutual exclusion? How does it do lock/unlock then?The output of the following program is only “Hello World”.@interface MyLock: NSLock<NSLocking> @end@implementation MyLock- (id)init {return [super init]; }- (void)lock {NSLog(@”before lock”);[super lock];NSLog(@”after lock”); }- (void)unlock {NSLog(@”before unlock”);[super unlock];NSLog(@”after unlock”); }@endint main (int argc, const char * argv[]) {NSAutoreleasePool * pool = [[NSAu
gav
java synchronization methods 2014-2-13 1:26:40
I have a simple method which is called from multiple threads;@Override public Bitmap getFullBitmap(Filter f, ProgressCallback<String> pc) {// Requires synchronisation?Bitmap bitmap = fullMap.get(f.id);if(bitmap == null){f.setProgressCallback(pc);bitmap = f.e.evaluate(currentBitmap);fullMap.put(f.id, bitmap);}return bitmap; }As none of the objects used are fields of the class (Apart from fullMap) is it ok just to call this or might one thread change the value of bitmap for example, while th
Michael
java vector synchronization 2014-2-8 20:44:44
When we don’t need synchronization ArrayList is faster than Vector. And when we do need a synchronized collection we’re better off using Synchronization wrappers (correct me if I’m wrong), or synchronizing the code only when there are calls on that collection. Are there cases where using Vector is the best option?
Jakob
c# silverlight synchronization isolatedstorage 2014-2-8 15:51:07
Since use of isolatedstorage storing for silverlight can provide a method for storing userdata locally and whikle not connected to the internet, I’m interested in hearing your thoughts about intelligently synchronizing dbdata and silverlight isolatedstoragedata.I’ve currently implemented a solution, but it seems a bit complex to me, so I’d like to hear if I could have done it differently.I have a list of documentobjects that I save to the isostore.the document has (datetime)DateModified and (boo
Abhi
c# asp.net .net synchronization thread-safety 2014-2-6 5:33:22
In my web application i am having following common objectList for all online users.public static List<MyClass> myObjectList = new List<MyClass>();so when multiple online users try to read data from this object myObjectList then are there any chances of thread synchronization issue. In another scenario multiple users are reading from myObjectList and few of them are writing also but every user is writing on a different index of List . Every user may add a new item to this list . So no
dmonopoly
java multithreading synchronization 2014-2-5 23:44:57
Let’s say you have a method foo() that is only called in a synchronized block.Is making the methodsynchronized void foo() {..}versus justvoid foo() {..}redundant or bad practice, or does it make the method’s intent clearer? Does having the synchronized keyword on the method signature make the program slower? I’m wondering what the better practice is, or if I’m missing part of the big picture.Thanks.
Mahdi Parsa
multithreading delphi synchronization delphi-xe3 tthread 2014-2-4 17:22:37
I must processing one image in main form , but the processing speed is low for inc speed i use thread…My thread code :typeTPaintThread = class(TThread)Source,Mask :TBitmap ;image : TImage;publicprocedure SetAll(src,msk:TBitmap;img:TImage);privateprocedure DoWritePix;varmBit : TBitmap ;protectedprocedure Execute; override;end;implementationprocedure TPaintThread.SetAll(src: TBitmap; msk: TBitmap; img: TImage); beginSource := src ;mask := msk ;img := img ;mBit := TBitmap.Create ; end;procedure
Geek
java synchronization locking wait 2014-2-4 14:37:27
It is an advocated paradigm that wait() should be invoked inside a while loop inside a synchronized block.My question is how does the waiting() thread get the lock back ?// Thread 1synchronized (mon) {while (!condition) mon.wait();// Do something}//Thread 2synchronized (mon) {//set condition appropriatelymon.notify();}Consider the thread 1 runs first and starts waiting for the condition. It releases the lock and the thread 2 obtains the lock sets the condition and notifies thread 1. Now thread 1
Stackie Overflower
java sockets synchronization 2014-2-3 3:39:11
I have 2 classes where i have one to send commands to a socket, another which receives(And sometimes answers commands) . Do I have to synchronize this? Or is this not necessary?Both classes run in their own threads with the socket object passed down to each of them as argument upon thread.start();Is this the proper way to do it or could I do something more efficient? Would this have chances of causing errors ? The sending part:public void run(){send_chatline(“roomf”);int vvv = 0;while (this.soc
Dinah
c# java multithreading synchronization 2014-2-2 3:25:50
Does c# have its own version of the java “synchronized” keyword? I.e. in java it can be specified either to a function, an object or a block of code, like so:public synchronized void doImportantStuff() {// dangerous code goes here. }orpublic void doImportantStuff() {// trivial stuffsynchronized {// dangerous code goes here.} }
ioeric
c++ c memory operating-system 2014-2-16 17:01:19
I was doing some experiments on the heap address growth, and something interesting happened. (OS: CentOS, ) But I don’t understand, why this happened? Thanks!This is what I did first:double *ptr[1000]; for (int i=0;i<1000;i++){ptr[i] = new double[**10000**];cout << ptr[i] << endl; }The output is incremental(for the last few lines):…. …. 0x2481be0 0x2495470 0x24a8d00 0x24bc590 0x24cfe20 0x24e36b0 0x24f6f40 0x250a7d0 0x251e060Then I changed 10000 to 20000:double *ptr[1000]; for
Bo Persson
java linux memory operating-system ram 2014-2-15 10:59:30
I’m new to Linux and have a question about memory limitations. As I know, in Windows you can only have 2.8 GB used in the 32bit version of OS, but what about Linux – is it 4 GB or less too?I’m particularly interested in Java application run in RHEL5. But if you have answers about other technologies – that would be awesome to listen to.
Karthik Balaguru
c compiler function operating-system entry-point 2014-2-14 2:57:55
Is it possible to avoid the entry point (main) in a C program. In the below code, is it possible to invoke the func() call without calling via main() in the below program ? If Yes, how to do it and when would it be required and why is such a provision given ?int func(void) {printf(“This is func \n”);return 0; }int main(void) {printf(“This is main \n”);return 0; }
Shonu93
python operating-system 2014-2-13 20:22:09
I want my program to open iTunes during runtime. How do I implement this ? I looked around for answers but didn’t get any concrete complete answers. Till now, all I know is I could use the os module and then call the os.system() function to open iTunes. If this is right, what goes into the brackets ? I have a Mac OS X machine.
erencan
java algorithm search operating-system cpu-architecture 2014-2-13 10:37:53
I have written code to implement linear search (starts from beginning of array) and Reverse Linear Search (starts from end of array). Now when I run the program on a sample of 1000 numbers, 1000 times (with different keys each time), this is the cumulative result.Total Time LS :814632 Total time RLS : 581558I wonder why do we have such a noticeble difference in execution times. I have used system.nanoTime() to check time. I think, considering a large distribution of 1000 (calling both functions
Marko Kocic
programming-languages operating-system 2014-2-13 2:52:02
This is probably more of a subjective question, but which language (not API like .NET or JDK) would you use should you write your own operating system? Which language provides flexibility, simplicity, and possibly a low-level interface to the hardware? I was thinking Java or C…
Samir Baid
memory-management process operating-system 2014-2-12 6:32:19
Is HEAP local to a process? In other words we have stack which is always local to a process and for each process it is seprate. Does the same apply to heap? Also, if HEAP is local, i believe HEAP size should change during runtime as we request more and more memory from CPU, so who puts a top limit on how much memory can be requested?
Abdul Rahman
java process operating-system exec 2014-2-11 6:59:01
I am creating a process using java runtime on a solaris OS. I then get inputstream from the process and do a read on the input stream. I expect (I am not too sure about the process, it is a 3rd party thing)the process outstream to be huge but it seems to be clipped. Could it be that there is a threshold on java side as to how much a process can have in its output stream?Thanks, Abdul
Karthik
operating-system dylib libc mach-o 2014-2-9 22:23:29
I am trying to override some libc functions (eg:- puts()) with my own implementation. I have defined my own implementation in a dylib file as follows.int puts ( const char * str ); When I link my binary with the dylib file in Xcode and build, my overridden version gets called. However, when I inject the dylib into my binary, I see that the overridden version is not called. I have verified that the dylib is getting loaded by logging something in the entry point of the dylib.Can someone here point
Kara
operating-system virtual-machine bytecode jit 2014-2-9 13:23:39
Is there any real advantage from Bytecode JIT execution over native code beside possible implementation of platform independency?Apparently languages that use “virtual machines” over Bytecode JIT execution are attributed several advantages. But in what extend would this really affect a discussion concerning advantages/disadvantages of native code and JIT execution?Here’s a list of attributes that I identify, the question is in what extend does this also apply to native code – if the compiler sup
user1002288
c++ multithreading boost locking mutex 2014-2-13 18:27:32
Is it possible to use mutex to lock only one element of a data structure ? e.g. boost::mutex m_mutex; map<string, int> myMap; // initialize myMap so that it has 10 elements// then in thread 1 { boost::unique_lock<boost::mutex> lock(m_mutex); myMap[1] = 5 ; // write map[1] } // in thread 2 { boost::unique_lock<boost::mutex> lock(m_mutex);myMap[2] = 4 ; // write map[1] }My question: When thread 1 is writing map[1], thread 2 can writing map[2] at the same time ? The thread lo
Michael Petrotta
ruby mutex eventmachine ruby-prof 2014-2-13 7:16:39
I profiled my event-machine based application with ruby-prof and found the following interesting:5.28 0.00 5.28 0.00 4/4 Mutex#synchronize 90.72% 0.00% 5.28 0.00 5.28 0.00 4 Mutex#sleepI think ruby-prof counts only CPU ticks, and hence I’m unable to figure out why mutex sleep might take CPU time. I’d assume it sleeps on the kernel level not counting towards the fiber time. Any ideas? Even better, I’d want the Mutex#sleep to release control to th
Johannes
java multithreading performance mutex 2014-2-10 17:27:55
Mutexes are pretty common in many programming languages, like e.g. C/C++. I miss them in Java. However, there are multiple ways I could write my own class Mutex:Using a simple synchronized keyword on Mutex. Using a binary semaphore. Using atomic variables, like discussed here. …?What is the fastest (best runtime) way? I think synchronized is most common, but what about performance?
Blue
vb.net multithreading thread-safety mutex nesting 2014-2-8 13:17:52
Good evening fellow stackers, I have a mutex and threaded related question about // ¦ = Run one or the other per call to routine|GROUP A| GROUP B | | A & B GROUP MUTEX | |=======|============| |A1 & A2¦ B1 & |B2|B3||MUTEX||==|==||B2¦B3|SituationIs this situation safe or viable?I have 5 sub routines in VB.NET and I can run them in 2 groups comprising of seperate subsets in an asynchronous threaded manner.However, as the horribly rough text-o-graph above shows, the mutex’s work on
Omar Kooheji
thread-safety language-features mutex 2014-2-8 0:59:53
I was pondering language features and I was wondering if the following feature had been implemented in any languages.A way of declaring that an object may only be accessed within a Mutex. SO for example in java you would only be able to access an object if it was in a synchrnoised block and in C# a Lock.A compiler error would ensue if the object was used outside of a Mutex block.Any thoughts?UPDATEI think some people have misunderstood the question, I’m not asking if you can lock objects, I’m as
Benjamin
windows winapi system mutex critical-section 2014-2-5 17:47:30
CRITICAL_SECTION locking (enter) and unlocking (leave) are efficient becauseCS testing is performed in user space without making the kernel system call thata mutex makes. Unlocking is performed entirely in user space, whereas ReleaseMutex requires a system call.I just read these sentences in this book. What the kernel system call mean? Could you give me the function’s name?I’m a English newbie. I interpreted them like this.CS testing doesn’t use a system call. Mutex testing uses a system call.(B
Brady
c++ c performance pthreads mutex 2014-1-21 11:34:54
I would like to know how to profile a pthread mutex to see if there are any locking contention points in my code. (who likes contentious code, right? 🙂 I know how to do a more general profiling of the code, as I mention here. But I would like to know if there are any tools or options available to be able to profile mutex locking that would provide metrics/stats about mutex locking contentions to see if I have any problem areas.Here’s some background and context:Recently I worked on an embedded
Tim Sylvester
c++ multithreading mutex boost-thread 2014-1-13 4:29:36
I have a class that is shared between several projects, some uses of it are single-threaded and some are multi-threaded. The single-threaded users don’t want the overhead of mutex locking, and the multi-threaded users don’t want to do their own locking and want to be able to optionally run in “single-threaded mode.” So I would like to be able to select between real and “dummy” mutexes at runtime.Ideally, I would have a shared_ptr<something> and assign either a real or fake mutex object.
Jamie
linux process mutex 2014-1-8 8:29:25
I’ve done a bit of digging, and the closest I’ve come to direct answer to my question is here.I’ve created a mutex then spin into a loop where I listen for activity on a TCP/IP port, fork, respond, then exit from the child. Part of the ‘respond’ requires that the child process access hardware autonomously, that is protected by a mutex.If I initialize a mutex before creating child processes, will all the potentially concurrently running children honor the mutex?
Oedo808
multithreading boost mutex 2014-1-7 7:03:03
I started using boost::thread recently (WinXP, VS10, BoostPro) and found that mutex can be unlocked by any thread, not by the thread that owns it only. Additionally it seams that the basic lock_guard + mutex combo is doing some internal counting of multiple lock() and unlock() but it is not a big issue I guess.Does somebody know why it was designed in such a way? Is it on purpose? (or maybe there is something wrong with my build environment / libs?)Example app:#include <iostream> #include
ubiquibacon
c pthreads global-variables command-line-arguments semaphore 2014-2-4 6:14:23
I am doing an assignment where I need to use pthreads or semaphores to synchronize some processes which access some shared resource. Since all of our examples in class use a global variable as the shared resource I planned on doing the same thing, but I wanted to base the value of the shared resource on a command line argument. I know how to use command line arguments within my main method, but how do I define the size of a global array (the shared resource) based on a command line argument?Up
kosh
c# dynamic semaphore resize 2014-1-26 23:37:48
I’m trying to use semaphores to control how many instances of a job can be run at the same time. While this is fairly simple with a wait method, I also want the value to be configurable at runtime so that I can bump the count up or down. I realize that there may be issues bumping the count down but is there a way to actually do this? Is this the right approach to be using semaphores?
nav_jan
c concurrency multiprocessing semaphore flock 2014-1-10 23:02:37
I am trying to create a shared memory which will be used by multiple processes. these processes communicate with each other using MPI calls (MPI_Send, MPI_Recv).I need a mechanism to control the access of this shared memory I added a question yesterday to see if MPI provides any facility to do that. Shared memory access control mechanism for processes created by MPI , but it seems that there is no such provision by MPI.So I have to choose between named semaphore or flock.For named semaphore if a
M.N
php concurrency queue semaphore 2014-1-9 2:42:43
I recently installed my video script to a new server but I am seeing that it will start to convert 1 video (via mencoder) then before finishing it, it will try and convery another, and another, so it will be trying to convert 4+ videos at the same time causing the server to shut down. The script developer said:”It converts each video in a PHP background process. There might be a way to limit the number of PHP background processes on your server and queue them.”So how is this done please?Regards
Dan O
c++ multithreading semaphore 2014-1-8 15:55:58
My code have one thread continuosly handling objects queued by other threads. Queued objects are created using “new” in a function that will have finished when the object will be handled. I have no problem with this but deleting the object. Should I just not delete the object? Maybe change the way of passing/creating this objects?Object* myQueue[10];function() {Object* myobject = new Object();queueObject(myobject); }queueObject(Object* object) {myQueue[index_x] = object;sem_post(&mySemaphore
Tisys
c++ c synchronization cross-platform semaphore 2014-1-8 1:10:18
I am currently designing a C++ cross-platform (Linux/Windows) server application with a large-scale synchronization pattern. I internally use boost::thread as an abstraction of the OS-specific threads. My problem is to protect an array of data, each element of the array being protected by an independent reader/writer lock.My array contains 4096 elements. Considering the solution of the “writer-priority readers-writers” problem that is presented in the “Little Book of Semaphores” (page 85), my ap
sgowd
osx posix semaphore named-pipes npapi 2014-1-4 1:21:03
On windows, I solved this issue by creating a named semaphore. If plugin 1 crashes while holding the semaphore, the semaphore is released. But its not the case with Posix (on Mac), where the semaphore stays alive. Since, sigaction will not release the SIGKILL on the semaphore, I have to abandon it.What is my best option.named pipes, ports, message queue, remote function execution?
Mones
ios grand-central-dispatch semaphore 2014-1-3 19:48:00
I’m having a problem using the dispatch_semaphore_wait(..) when the semaphore was created with a value greater than 0sema = dispatch_semaphore_create(2); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{//signals here });dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); dispatch_release(sema);Shouldn’t the wait has to wait for two signals? In the code above it doesn’t wait at all and so the release is called and the result is a crash!
Jonathan Leffler
c linux semaphore 2014-1-3 11:58:59
I was checking the semop() function and the flag value of structure sembuf could be either SEM_UNDO or IPC_NOWAIT. So in the case that we pass flag value as 0 then what will be the behavior? Somewhere I read it was a no operation. What does that mean? Can anyone explain?
Sandbox
c# multithreading concurrency semaphore 2013-12-30 21:29:57
http://msdn.microsoft.com/en-us/library/system.threading.semaphoreslim.aspxTo create a semaphore, I need to provide an initial count and maximum count. MSDN states that an initial count is – The initial number of requests for thesemaphore that can be grantedconcurrently.While it states that maximum count is The maximum number of requests for thesemaphore that can be grantedconcurrently.I can understand that the maximum count is the maximum number of threads that can access a resource concurrentl