sumit kumar
BAN USER- 0of 0 votes
AnswersSuppose there is a directory XYZ having too many files (100 to 10000). Each file contain the format like first line having company name and second line some data values. We need to read each files in directory and create the new directories at some path with company names and move that file (1.txt ) to that directory.
- sumit kumar in United States
what should be design.
My suggestion was to Create a function ScanDir() which will read the count of files and will make loop to read the file and will create a thread for that file and move to next file and process the all files.| Report Duplicate | Flag | PURGE
Senior Software Development Engineer C++
@tarun: why u want to checkdirexist above the mutex as well ?
- sumit kumar May 24, 2013Assign means picking a thread from thread pool. Identifying the which thread id is free so we can use it by traversing the complete pool or by some look up method or we creating two separate list of free/busy or some marking of free/busy is there array/queue based pool.
- sumit kumar May 24, 2013For Repeated company name the directory will be created only once and files will be moved to that directory. But there can be case when two thread having the same company name are executing in parallel then we need to implement synch mechanism (e.g mutex )
pthread_mutex_lock()
if (!checkdirExist())
createDir()
pthread_mutex_unlock()
movefiletodir().
RepMorrisHelen, Speech writer at Micro Design
I am a speechwriter who works directly with senior executives or leaders to determine what points, themes, positions, or messages ...
RepEllaWilliams, Analyst at A9
I am a perceptive systems analyst adept at designing innovative IT solutions and enhancing existing systems with new features. I ...
RepBeccaElyn, Accountant at ADP
Basic literacy is generally a requirement for order-filling positions, because order fillers need to be able to understand written lists ...
RepMarlinThomas, Backend Developer at ASAPInfosystemsPvtLtd
I am Marlin, an industrial maintenance mechanic. I can help you create a job listing. Feel free to revise, add ...
RepValerieRodri, Associate at Apache Design
I am a Medical equipment repairer in the Morehouse lab at the University of Wichita. I enjoy working with high-technology ...
RepJessicaMoss, Member Technical Staff at Bloomberg LP
Jessica , a technical writer with 5+ years of experience writing high-quality internal and user-facing support. As I love to write ...
Repmariadbulter222, Android Engineer at ABC TECH SUPPORT
Hey, I am a corporate investigator. I love this work. My hobby like write story and different types of article ...
RepAtharvFlores, Accountant at A9
I am working as a position of a court clerk to assist the judges as attorneys in expediting the court ...
RepGrimesOtto, Java Developer at Coupondesh
I am Grimes Agriculture inspector. I examine agriculture commodities and related operations . I like listening to music, painting, and reading ...
RepAbbyCox, abc at 8x8
I am an experienced, officially certified driving instructor. Excellent driver with a great safety record. Encyclopedic knowledge of traffic rules ...
RepValerieHill, abc at 8x8
I am a highly motivated development and community advocate with over 2 years experience fostering strong community relations product advancements ...
RepSidneyWarren, Development Support Engineer at Abs india pvt. ltd.
Sidney , Materials Planner adept at analyzing the usage of production materials, managing inventories, coordinating new personnel vashikaran specialist contact number ...
RepRomiTerry, Member Technical Staff at Cleartrip.com
Romi , a Dynamic Property Manager highly regarded for increasing and maintaining a high level of occupancy adhering to all regulations ...
Replvadorjimen, General clerk at Freedom Map
I am a General clerk . I handle a wide range of clerical duties, from filing paperwork to answering phones and ...
RepMiguelCortez, Accountant at Apache Design
I am a webmaster and a person responsible for maintaining one or more websites. I spend most of my time ...
Replloismyers, Grounds maintenance worker at Eagle Hardware & Garden
I am a ground maintenance worker who typically mows grass, edges, and fertilises lawns. I also weed and mulch landscape ...
Repmanduj972, Executive chef at Neptune, NJ 07753
Hello, I am Mandu and I completed all my study from Neptune. today I am working as an Executive Chef ...
Repdorothylopez7485, Analyst at ABC TECH SUPPORT
My name is Dorothy and I am a Host. Nowadays I am doing a new experiment like spell to keep ...
RepTracieHoutz, Animator at ADP
I am Tracie , currently the Associate Art Director at Curtie , where I have an excellent reputation for my strong conceptual ...
@eugene: I know its not good idea thats why i posted it to get to know alternate solution.
- sumit kumar May 24, 2013