Find Jobs
Hire Freelancers

Data Structure in C prog. ..operating systems typically set aside a portion of the computer&'s RAM to cache recently read files. While the amount of RAM is much smaller than size of a disk drive, if many files are accessed repeatedly, a good hit rate can

$30-75 USD

Completed
Posted about 20 years ago

$30-75 USD

Paid on delivery
1 Introduction Reading files from disk is a costly operation - usually at least 10ms of time. In constrast, reading data from memory is much cheaper - usually less than a microsecond. Accordingly, operating systems typically set aside a portion of the computer’s RAM to cache recently read files. While the amount of RAM is much smaller than size of a disk drive, if many files are accessed repeatedly, a good hit rate can be achieved. For this project, you will be creating a Cache data type to store the contents of recently read files. 2 The Cache data structure A Cache is a dictionary-like data structure that never keeps more than a certain amount of data. Your Cache will support the following interface: typedef void* Cache; typedef void* DataC; Cache makeCache( int maxTotalCost , void* (*copyDataC )(DataC to, DataC from) , int (*compareDataC )(DataC d1, DataC d2) , void (*freeDataC )(DataC freeMe) ); void freeCache( Cache c ); boolean insertCache( Cache c, DataC d, int cost ); boolean accessCache( Cache c, DataC d ); void setMaxTotalCost( Cache c, int newMaxCost ); int getMaxTotalCost( Cache c ); int getNumItems ( Cache c ); int getTotalCost( Cache c ); Figure 1: Cache.h When a Cache is constructed, it is given a maximum total cost. Each data item that is inserted has a corresponding cost. At any point in time, the sum of the costs of the data items shall never exceed the maximum. If a new item is inserted that would raise the total cost beyond the maximum, the Cache will automatically remove the least recently used (LRU) items, one at a time, until the current total cost is small enough for the new item’s cost to be added. To do this, the Cache will internally keep a sorted list of data items: the least recently used item will be at the tail of the list; the most recently used item will be at the head. Whenever an item is inserted or accessed, it will be moved to the head of this list. That way, items that are not used will eventually wind up at the end of the list..... the complete version of the prog is in the attachment ## Deliverables 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request. 3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement) ## Platform The due date is 2nd of March 2004 The project must be written in C and C programming only. It must be well documented. must include users' manual, programmer logic file and the dot c file. Every detail of the specification should be followed. The operating system or environment the program will run on Unix
Project ID: 3110394

About the project

4 proposals
Remote project
Active 20 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$54.99 USD in 8 days
5.0 (160 reviews)
6.0
6.0
4 freelancers are bidding on average $49 USD for this job
User Avatar
See private message.
$59.50 USD in 8 days
4.9 (62 reviews)
5.4
5.4
User Avatar
See private message.
$46.75 USD in 8 days
4.9 (25 reviews)
4.0
4.0
User Avatar
See private message.
$34 USD in 8 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
4.9
3
Member since Feb 4, 2004

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.