Programming :: Use The Mutexes To "protect" The Access To The Queues

Dec 22, 2010

I'm using the Posix's mutexes in a project. I have 3 threads and 3 queues. The problem is: I used the mutexes to "protect" the access to the queues. But the first started thread monopolizes the use of the queues. See a example code:

[Code].....

View 3 Replies


ADVERTISEMENT

Programming :: Mutexes Necessary - Gets Locked / Unlocked Each Time One Of The 60 Threads?

Jun 24, 2011

I'm a bit worried about "too many mutexes" in my little curses-based app and would like to get confirmation/opinions that I'm doing this right. I've got an array: int nums[60] I've got 61 threads. 1-60 are doing math on the value in their array index (ie: thread1 increments nums[1], threadN increments nums[N]), then sleep(1) The 61st thread is my curses thread which does a for-loop over the array and prints out all the values to the screen, then sleep(1)

Right now, I've got 1 mutex which gets locked/unlocked each time one of the 60 threads needs to update its array-index with a new value, and the 61st thread locks the same mutex just before the for-loop beings reading the values and unlocks after ending the loop.

My questions:
A) Does the above seem OK? (I know it's ok, cause everything works right now but would like opinions on it)
B) Do I even need the mutexes since 1-60 only ever update their own index and 61 just reads?
C) If I do need the mutex protection, is there a better, more efficient way?

View 11 Replies View Related

Programming :: Listening Message Queues

Jan 26, 2011

I am implementing an IPC mechanism using message queues (Sys V).I can receive the messages using msgrcv() function. I am wondering how can I listen on the new messages. I would like to implement a mechanism that would notify me when there is a new message in the queue for me and I will call the msgrcv() function to retrieve the message.

View 4 Replies View Related

Programming :: Python: Simple Message Queues / IPC?

Mar 10, 2010

I have this daemon I'm writing in Python, but I still a Python n00b. I've coded the part of the daemon that does the work, but not the part that receives messages. I need a simple system so that other processes on the same (Linux) computer can occasionally send text-string messages to the daemon (without needing to stay running all the time themselves). Once in the past we did something similar by (mis)using pyliblo to listen for OSC messages coming in on a certain port. That option isn't as workable here because the pyliblo interface (as near as I can tell) requires you to know in advance specifically what messages you are expecting, and forward them to specified functions, rather than just allowing you to generically process incoming messages as you see fit.

View 1 Replies View Related

Programming :: Difference Between Message Queues And Named Pipes

Mar 1, 2011

recently I had been to interview where I had a question to be answered, that what are advantages and disadvantages when desiging an application in linux.

View 1 Replies View Related

Programming :: Closing / Unlinking POSIX Message Queues?

Apr 15, 2011

I have a pthread waiting forever on a POSIX message queue and then call mq_close and mq_unlink on the POSIX message queue. I've found that the pthread never wakes up from it's call to mq_receive and remains blocked indefinitely. Is there a way to wakeup all pthreads blocked on a POSIX message queue after calling mq_close/mq_unlink? The goal is to include error handling during message queue deletion to avoid leaving any pthreads blocked forever.

View 2 Replies View Related

Programming :: Posix Message Queues - Communicate Between Two Threads?

Jan 3, 2011

I want to communicate between two threads, each belonging to a different process. Iam using message queues for this. I use mq_open()call. I created the queues with the same queue name starting with a '/'. But when I open the queue, the queue ID is different in both the process. What should I do so that both the process have the same queue ID?

View 1 Replies View Related

Ubuntu :: Password Protect Xp Partition Access

Mar 4, 2011

I am currently running Lucid 10.04(lts) on a dual boot with windows xp. What i am looking for is some guidance on how to re-install the requirement for a password when trying to mount the xp partition as this was standard in Jaunty and i liked it like that as my computer is often open for many hours at work. Yeh i know i can lock the screen but sometimes other people need to use my computer.

View 6 Replies View Related

Security :: Protect Samba Server For Limiting Access To Certain Domains?

Nov 24, 2010

I was looking for a way to protect my samba server for limiting access to certain domains.Can I use the parameterhosts allow = example.comor something like that or is there another way to do the job for domains

View 4 Replies View Related

Ubuntu Security :: AppArmor Protect Devices And Limit Their Access To The File System?

Nov 9, 2010

This might sound really stupid, so you'll all have to excuse my lacking knowledge. I read that USB attacks get more and more common, like putting in an USB stick with a malicious autorun script on it, and it's game over. Can AppArmor protect devices and limit their access to the file system?

View 5 Replies View Related

Programming :: Protect File From Deletion In C Code?

Apr 26, 2011

I create the file mytest.txt. Since this process is using this file. if I run this code in background and simply run "rm -rf mytest.txt" than file gets delete. Here is my code

int main()
{
FILE *fp;
fp = fopen ("mytest.txt","wb");
if (NULL == fp)
{

[Code]....

View 7 Replies View Related

OpenSUSE Hardware :: Slow Performance With Mutexes And MySql On Multi Core CPU - AMD Phenom II X4 965 - With 11.3

Nov 11, 2010

I have installed OpenSuse 11.3 32 Bit in a virtual machine on an older computer on a Windows XP host and on a new computer with AMD Phenom II X4 965 processor.

With sysbench I tested the performance of mutex and on the new computer it is 3 - 4 times slower than on the virtual machine. Other performance tests with sysbench for CPU, memory and threads are faster on new computer like expected. I tested this, because I have a slower performance of table creation in MySql tested with sql-bench, where creation of 10000 tables lasts 45 seconds on the virtual machine but over 400 seconds on the new computer.

I have tested with kernel-desktop and kernel-default but there are not large differences. File creation was tested with bonnie++ and is on newer computer faster as expected.

My questions are:
- Why is the mutex handling on the multi core CPU slower than in the virtual machine and how to speed up this?
- Or is there another reason why table creation of MySql is so much slower on multi core CPU?

View 7 Replies View Related

Slackware :: SBopkg Queues Git Download?

Jun 4, 2011

Anyone know of the simple (!) command syntax to : a) download the full SQF tree from [URl].. b) maintain that tree WITHOUT having to download the whole dang thing again.

I'm 100% certain this is possible - that's exactly what source-code repository tools like subversion and git are supposed to do. But Git is complex and that site doesn't seem to have an obvious (to me) method of doing part b)

View 4 Replies View Related

Ubuntu :: Setting Up Multiple Cups-pdf Queues

Oct 21, 2010

I have an Ubuntu Server running CUPS-PDF successfully. The problem that I am running into now is that we want to have different CUPS-PDF queues.Example:Joe from Finance wants his PDF prints to go to /home/finance which is samba shared out to all users in Finance. Mark from Operations needs logs printed out to /home/ops which is samba shared to all users in Operations and must be landscape.Finance and Operations print from the command line (lp -d print-queue filename) on the server via ssh since their app runs from a terminal.

I have looked and looked all over the net and through the cups-pdf documentation to see if there is a way to force the URI for the cups-pdf print queue instead of it going to the default of $HOME/Desktop as stated in my /etc/cups/cups-pdf.conf file. Basically, I want to set up a cups pdf printer called Finance, Advert and Ops that has all the options they need so when they print something from the linux applications, and they tell it to print to the virtual printer that they have permission to use and it go to the respective directory that they have access too.

View 2 Replies View Related

Debian Configuration :: CUPS Raw Print Queues Not Working?

Apr 16, 2011

I am trying to set up a print server here on a Squeeze system using the stock debian CUPS package. It seems that since Apple has bought this package, it has caused me nothing but grief. I have set up two different USB printers with raw print queues, and every time I send a print job to either of them, the job disappears into thin air, with no error output. In fact, when I look at the queue, it says the job was completed successfully. I look at the logs, and there is no output indicating any issues. Just for kicks, I reconfigured one of the printers to use a linux driver, and it printed just fine (a little slow, but fine). I set it back to raw, and the jobs disappear again into oblivion.

I have done this many times in the past, and never had any issues -- I even had this very same printer set up that way about a year ago, and it worked great. The only noteworthy thing that seems to have changed is that there are no longer any files called "mime.types" and "mime.convs". It seems they have been replaced by "raw.types" and "raw.convs". The contents of these two files are as follows:

raw.types: application/octet-stream

View 9 Replies View Related

General :: Exim Setup For Large Outgoing Mail Queues?

Apr 25, 2011

I have a fairly standard Exim setup for inbound and outbound mail. Recently our development team has put together a PHP app that allows us to send out bulk mails to our clients. The PHP app uses standard PEAR libraries to initiate an SMTP connection to localhost (application and mail server are on the same box). The idea here is that the application will send out roughly 10'000 emails in a very short time period (60 seconds or so) which Exim will then hold in its queue for delivery.

The problem comes in where after about 50 emails, Exim stops accepting mail and loggs the following error in the exim_main.log file: SMTP command timeout on connection from localhost [127.0.0.1] Could it be that this is because Exim immediately starts delivering the mail and then stops accepting new incoming connections? I thought that increasing the SMTP limits may be the problem here, but even after setting new values in the exim.conf file to the following, I still get the same problem:
queue_run_max = 5000
smtp_accept_max = 5000
smtp_accept_queue = 5000

This begs two questions: How do I resolve this? What is the best way for configuring Exim to accept a huge amount of mail into the queue in a very short time period, but then gradually delivery it once it's all in the queue? I've seen some people run separate Exim daemons for incoming and outgoing mail; is this a good solution?

View 1 Replies View Related

General :: Close/remove Message Queues Without Software Or Mq_close / Mq_unlink Command?

Jan 17, 2011

i am working on a project that uses message queues. i am able to successfully create them and they are working fine. now the problem is to close/remove message queues without software or mq_close / mq_unlink command. earlier when i worked on rh9, there is ipcs utility. we use ipcs to see all the existing message queues and ipcrm to remove them. however ipcs is not working for message queues in RHEL 5.3. Neither ipcs shows the exisiting message queues and neither we are able to use ipcrm. Plz guide to close/remove the queues with ipcs or any other command/utility from shell itself.

View 1 Replies View Related

Server :: Copy / Backup Postfix Mail Queues And Paste Folder Back In After Done Migrating All Users And Mails To A New Mailserver?

Apr 25, 2010

can i just copy/backup postfix mail queues in /var/spool/postfix and paste that folder back in after i done migrating all users and mails to a new mailserver?

View 3 Replies View Related

Kernel :: Use Message Queues For Sending Message?

Apr 16, 2010

I was trying to use Message Queues for sending message from aninserted kernel module to user space. The function sys_msgsnd failedgiving the obvious error -EFAULT.However, I was able to send the message from kernel to user space when I had made the same driver part of kernel (and not inserting it).How is that possible?I am using linux.2.6.19.x (arch=ppc)I now use Netlink socket to communicate from kernel to user, but the aboveproblem seemed strange to me.

View 2 Replies View Related

OpenSUSE :: How To Protect Apparmor Itself

Jun 2, 2010

recently I am interesting at apparmor, and I have read some docs of it, but I have a question that how to protect apparmor itself? I mean only if gained root privilege then stop apparmor service, all the protection will no longer effect, if I hiding or remove root user then how to remodify profiles if needed that because have not enough privilege.

Is there apparmor maillist? maybe you can email me: <email removed for obvious reasons>

View 2 Replies View Related

Security :: HOW TO Protect From VPN Attacks

Jun 1, 2011

I would like to know how to protect networks against VPN attacks? How does big industries do it? What does the government tend to use? Are any tools open source that I may get?

View 1 Replies View Related

Ubuntu :: 10.04 How To Protect Grub Entries

May 19, 2010

In ubuntu 10.04 how to protect Grub Entries...?

View 3 Replies View Related

Ubuntu Security :: Does Firestarter Protect Out Of Box?

Sep 15, 2010

I was wondering if firestarter (software firewall) works out of the box or does it need some kind of configuration in order for it to provide protection? Is firestarter even needed with ubuntu?

View 6 Replies View Related

Ubuntu :: Password Protect USB Ports

Oct 20, 2010

does anyone know how to password protect the USB ports so if someone were to plug something in that is USB Ubuntu would ask for root password before allowing access to the device.

View 4 Replies View Related

Ubuntu :: Does 10.04 LTS Protect You From DDoS/Dos Attacks?

Oct 31, 2010

I was just wondering if you were to get DDoSed/Dosed would ubuntu block the packets or protect you in some way?

View 1 Replies View Related

Ubuntu :: <ask> Protect Folder From Copying?

May 3, 2011

i will protect my folder so if someone want to copy that folder include container, he must enter right password first oh yeah i will store it in ntfs partition and backup in exsternal hardisk anywants how to do it in both of them, please share here because i already try to use permission but it's failed

View 1 Replies View Related

Ubuntu :: Any Way To Password Protect Whole Folder?

May 14, 2011

Is there any way to password protect a whole folder?

View 3 Replies View Related

Ubuntu :: What Should Backup To Protect System?

May 27, 2011

I am relatively new to Linux, What files/Folders should be backed up and what ones are not necessary?This is my 2nd install of 11.04 because I screwed the 1st one, so Im not sure what to backup to prevent having to reinstall if I screw up again.

View 9 Replies View Related

Ubuntu Servers :: Protect A Folder In My VPS?

Jun 28, 2011

I want to protect one of the folders in my VPS which is running under Ubuntu server 10.04 LTS I've tried doing this using .htaccess and I am being prompted for a user name and a password but when i enter the user name and the password I get the same window again but I am sure that I am entering the correct information. this is the .htaccess file code...

this file is located in the same folder that I want to protect. code...

View 1 Replies View Related

General :: Protect A Pdf From From Print / Copy?

May 6, 2010

How can I protect a pdf from from print or copy?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved