The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Design of a CMOS Clock with Synchronisation Capability iBot UNIX and Linux RSS News 0 10-07-2008 01:30 AM
Bookmark Sync and Sort: Bookmarks synchronisation with privacy iBot UNIX and Linux RSS News 0 01-28-2008 05:50 AM
sh : URGENT synchronisation insmod in script crip01 Shell Programming and Scripting 1 10-21-2005 09:24 AM
shared memory synchronisation student00 UNIX for Advanced & Expert Users 0 08-19-2004 06:36 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-28-2009
Gnaag Gnaag is offline
Registered User
  
 

Join Date: May 2009
Posts: 6
Thread synchronisation problem...

Hello, hope my english will be sufficient to be clear enough...

I'm in progress on some script that should copy one big source file (200GB average) on one sata drive, to multiple (30+) sata drives.
Hardware is not the problem but copy performance is... If i launch all copy process at the same time, source device is overrun by read IO and performance is (very) bad. If i launch one copy after one copy, copy performance is ok but i have multiply copy time by 30...

Let's summary the story :

i thnak to some script that read via ''dd'' in block mode to a ramdrive, ''1MB per 1MB piece'', then this script launch n writing dd (n = number of destination devices) to destination devices from ramdrive.
Idea is reading from a ramdrive with 30+ thread at the same time do not cause catastrophic perfomrance drop as it does with mecanical source device.

BUT...

I'm just facing a simple but big problem :
in the writing part of my script, i'm launching several ''write dd'' at the same time :
dd if=/mnt/ramdrive/buf.dat of=$destination/stillwriting.tmp bs=$BS seek=$POINTEUR_BLOC oflag=append status=noxfer &
"&" is my only known way to launch parralel process in a script, the problem is that the script continue to run and especially begins to put following 1MB block to ramdrive BEFORE end of all writing process. This result in corrupted files. I'm quite sure of that diagnostic because if i insert some sleep commande in my writing loop, error do not occur (but performance is lower and it's kind of very dirty scripting...).

Would you know a way to pause running of my script until all writing process are finished ?


Thanks a lot for your help from Paris !
  #2 (permalink)  
Old 05-28-2009
pludi's Avatar
pludi pludi is online now Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,857
Yes there is. It's called 'wait', eg
Code:
( sleep 30 ; echo "Sleep ended" ) &
echo "After sleep"
wait
  #3 (permalink)  
Old 05-28-2009
Gnaag Gnaag is offline
Registered User
  
 

Join Date: May 2009
Posts: 6
Thanks for this answer !
However, pardon me but i'm still in doubt in applying this wait command to my portion of script :

Here is my loop :
$2 is a file containing destination path list. It oculd be as big as 30 or more different paths. So the blue loop is creating as many dd processes as number of different destination paths. Those dd processes have to be completed before going to the read of following block.

for i in `seq 1 $NB_PASS`
do


#copie d'une tranche vers ramdrive. "Read" from source to ramdrive
dd if=$1 of=/mnt/ramdrive/buf.dat bs=$BS count=$COUNT skip=$POINTEUR_BLOC status=noxfer

#copie de cette tranche vers les destinations. "Write" from ramdrive to multi destinations
for destination in $(cat $2)
do

dd if=/mnt/ramdrive/buf.dat of=$destination/stillwriting.tmp bs=$BS seek=$POINTEUR_BLOC oflag=append status=noxfer &
done

POINTEUR_BLOC=`expr $POINTEUR_BLOC + $COUNT`
done

I would like that the blue loop wait for all it's child dd process to finish before go back to red loop.

Last edited by Gnaag; 05-28-2009 at 09:00 AM..
  #4 (permalink)  
Old 05-28-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,926
Code:
dd if=/mnt/ramdrive/buf.dat of=$destination/stillwriting.tmp bs=$BS seek=$POINTEUR_BLOC oflag=append status=noxfer &
done

wait 

POINTEUR_BLOC=`expr $POINTEUR_BLOC + $COUNT`
  #5 (permalink)  
Old 05-28-2009
Gnaag Gnaag is offline
Registered User
  
 

Join Date: May 2009
Posts: 6
seems to work !

Thnak you very much for your help, have a good day !
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0