I just started with Pthreads and don't really know much about it. I want to suspend pthreads but apparently, there is no such function as pthread_suspend. but I don't understand why we need both mutex and condition to suspend and resume a pthread. Is it possible to suspend and resume it without using conditions?
i think we can simulate preemption by using 2 different priority thread, am i true? I just try these scenario : 1. Create Thread A with priority 99 , SCHED_FIFO.. 2. Create Thread B with priority 4 , SCHED_FIFO
Thread A started and doing some busy work.. I guess that Thread B wouldn't start until thread A finished, but I get thread B can run before Thread A finished (It just like a common task switching).. I'm sure my 2 thread has right priority. and if thread B is doing some work and if i yield it to thread A, it should preempt it but this doesnt happen, do someone kno wats happening?
I am trying to write a peer to peer application in C++ using pthreads library. There are few types of nodes that run in the program. The 'beacon' nodes form the core of the network. The ordinary nodes 'join' the network by sending join requests to the beacon node. So, my program runs till the join requests and responses are received. When I try to 'connect' using connect function from the socket library, I get a segfault. I am not sure if the segfault occurs for the connect function, because sometimes the program just runs to completion. It could be an issue related to threads or memory allocation.
When I run gdb, it shows me the following: Code: (gdb) run b2-n00.ini Starting program: sv_node b2-n00.ini servant:12600> [New LWP 1] [New LWP 2] [New LWP 3] [New LWP 4] [New LWP 5] [New LWP 6] Before Exiting[LWP 1 exited] procfs: fetch_registers, get_gregs line 3768, /proc/23952/lwp/1: No such file or directory.
I have a program that uses both Pthreads and OpenMP. Basically, 2 threads (Thread A and B) are created using Pthreads to do work, and in Thread A, OpenMP is used to parallelize a for loop.If I have a global variable that is accessed by the OpenMP threads and also Thread B, can I use the lock in OpenMP to ensure I have no race conditions?
In the main thread, i have put up a timer which generates a signal periodically when it expires, which reults in execution going to signal catcher function.when this function is invoked, under certain condition it goes to thread 1 and under another condition it goes to thread 2. The problem lies here that when it goes to thread2,i have a loop to process but it doesnt come out of the loop and hence from thread2, even though timer has expired.
In my script, i am using NSLOOKUP to get the ip address of a host that just rebooted and connected to my network (this part has been done).But now i want to check the myhosts.txt file if the host has the same or different IP address, if is different then myhosts.txt file must be updated with the new IP.i am using the following AWk command:
it prints on screen fine and i see the host4's ip address gets replaced but the actual file does not get updated with the new IP. I might need to use gsub?
need to modify some scripts to repeat the commands in them until a variable returns a proper value. I need it to add some redundancy to some scripts i use to upload files to a remote server.This is an example of a portion of those scripts:
I'm trying to implement an assert function similar to:[url]
However, I'm having trouble with file existence testing when the file name has a space in it.
I have distilled the problem down to the following:
This code works as expected, printing 'yes' if '~/test file' exists, and no if not.
Code:
However, this code gives an error.
Code:
The error:
Code:
Which tells me that it is splitting ["~/test file"] into ["~/test] and [file"]. Why? Is there a way around this?
Note that if you simply use a file path without a space, both cases work perfectly. Is this a BASH bug possibly? I just can't understand why the first would work, but the second wouldn't.
In my code I want to have two different functions to be executed simultaneously (in parallel) in a single processor system. I tried to use pthreads but they happened to be executed one after another. I have heard about fork, some saying that its no longer recommended since its functions can be achieved by pthreads.
I want to suspend/resume a thread. The library I am using is pthread.h.I am also running my application on linux.Is there any function in pthread. let me suspend a thread temporary?I have read a document in which it was mentioned thatthread does not support suspend/resume
If I suspend this toshiba satellite, and the battery is or gets low it will wake from suspend to tell me that it will need to suspend due to a critical low battery. Which is pretty dumb. I've experimented with this by plugging and unplugging the ac adapter.
1. is it possible to schedule this command in the same manner as shutdown ? eg sudo shutdown -h 60
2. is it possible to schedule the laptop to come out of suspend ?
3. i have a usb sound card (xfi go). when waking from suspend, the internal sound card is selected. i have to manually select the external sound card & for whatever reason, also unmute it too
I need to write an else-if condition in a makefile, and though the format is posted on several websites, nothing seem to be working, andI get an error everytime. Could anybody please write a small example with an else-if conditional in a maekefile?
When I used windows, I used to perform following operations on regular basis: 1) disk cleanup 2) disk defragmentation 3) virus/spyware/malware check 4) deleting temp files left by deleted files 5) and many more....... Does Linux system needs that to be done too? What should be done to maintain Linux in fast & furious condition....as it is now.....
Is there some way to filter output of command by OR condition in Linux? There is filtering by AND condition with grep in way like: ls -l | grep "^a" | grep "z$"
That says: list all files that beggins with "a" AND ends with "z" (so there is shorter way to write this: grep "^a.*z$", but it is not matter). Is there some way to perform test by OR condition? For example: files that starts exactly with "xen" OR files that ends exactly with ".rpm". But exactly, not something like: grep "[xen]{0,3}.*[.rpm]{0,4}"
How can I have ELSE condition in procmailrc I mean if the mail was from X and Subject has Y OR .... DO something ELSE DO SOMETHING ELSE. I do not want to use two different conditions for each state I want use just one condition and its ELSE because putting too recipes in procmailrc make it too slow .
First of all, This is my first post in the forums, so - Hello all, nice to meet you. This is my first time with Ubuntu, and so, ran into a lot of problems. This problem is in installing counter strike. I know that there are a lot of guides and FAQ's online that give you lots of help on that, but I ran into an unique problem.
I installed the non-steam version of Counter Strike ( using wine ofcourse ). It created a shortcut in my desktop and I launch the counter strike game. I enter my cd key and then I select a profile, select a map, select the bots and then, it starts loading. After that, it stops half way and then it quits.
I have two dhcp server (dhcp3) in the same network, this network is a link layer network so every host is seen as directly connected. The two servers have debian lenny and there are near 13 AP mikrotik to give connection to the XO laptops (from the project one laptop per child). This is for two public schools (each one with one server) that are connected via a p2p connection and each one provides internet for the school and outdoor too. The servers are also file servers, proxy, etc.
Each time a laptop asks for an IP, it sends a broadcast message and this petition gets to both servers, now a days the first server that reply is the one the laptop associate with. What I want to do is, knowing the bandwith use of the ADSL, the clients connected to the server, and the cost to the AP that the laptop associate with, decide wich is the best server to be connected to. What I want to achive is to balance the load and to decide the optimum connection, because now it could happen that one server is very loaded and the other is free. I tried to run dhcp with inetd and use tcp wrappers to invoke a script to check a condition before responding and, in case to be the best server, reply to the laptop, but i couldn't get the dhcp server to respond when I run it with inetd. here is my inetd.conf
Under high UDP traffic condition, we find we cannot receive UDP packet (can be captured by tcpdump) from socket neither use bare "recvfrom" nor "select recvfrom " pair. Is there any similar problem reported from user?
Any tunning or socket establish option can help?
Or is there any improvement available from the latest version?
our using linux version is CentOS 5.5
ethernet driver version is Intel (R) Gigbait Ethernet Network Driver version - 1.3.16-k2