[comp.sys.mac.programmer] System 7 and cache

tel@adimail.UUCP (Terry Monks) (01/24/91)

A bbs I wrote has been fine except for one user who manages to crash it
any time. Well, that's my problem and I will look further (Yes, I *am*
using the Communications Toolbox) 
 
   The problem is that when the system crashes and I reboot, the last few
message files are not updated, and I can only assume it is because they
are still cached. So I go to the control panel - memory - and note that
disk cache is adjustable but is always on. Is there *any* way to turn
it off?

-- 
Terry Monks        Automata Design Inc    (703) 472-9400

fry@zariski.harvard.edu (David Fry) (01/25/91)

In article <636@adimail.UUCP> tel@adimail.UUCP (Terry Monks) writes:
>A bbs I wrote has been fine except for one user who manages to crash it
>any time. Well, that's my problem and I will look further (Yes, I *am*
>using the Communications Toolbox) 
> 
>   The problem is that when the system crashes and I reboot, the last few
>message files are not updated, and I can only assume it is because they
>are still cached. So I go to the control panel - memory - and note that
>disk cache is adjustable but is always on. Is there *any* way to turn
>it off?
>
>-- 
>Terry Monks        Automata Design Inc    (703) 472-9400

First, if you're using the System 7 beta as an actual working
system, it may be unwise to attribute any particular problem
to anything other than using the beta itself.  I find it quite
stable, but it does have reproduceable bugs.

That said, you will not leave information in the cache if you
use the file manager correctly: you should call FlushVol()
periodically, usually everytime you close a file or if you're
going to go long times between FSWrites() (when something like
a system crash may occur).

As for your original question about turning off the Sys 7
cache: I don't know :-).

David Fry                               fry@math.harvard.EDU
Department of Mathematics               fry@huma1.bitnet
Harvard University                      ...!harvard!huma1!fry
Cambridge, MA  02138            

Greg@AppleLink.Apple.Com (Greg Marriott) (01/25/91)

In article <5457@husc6.harvard.edu>, fry@zariski.harvard.edu (David Fry) writes:
> In article <636@adimail.UUCP> tel@adimail.UUCP (Terry Monks) writes:
> >disk cache is adjustable but is always on. Is there *any* way to turn
> >it off?
> ...
> As for your original question about turning off the Sys 7
> cache: I don't know :-).
I do.  The answer is...... no.

Greg Marriott
Blue Meanie
Apple Computer, Inc.

MacUserLabs@cup.portal.com (Stephan - Somogyi) (01/26/91)

fry@zariski.harvard.edu (David Fry) writes about caching:
 
>That said, you will not leave information in the cache if you use the
>file manager correctly: you should call FlushVol() periodically,
 
I remember someone telling me recently that regular FlushVolling
doesn't necessarily guarantee the cache to be flushed.
 
Could someone please shed some light on this? Keith?
 
Stephan
 
___________________________________________________________________
Stephan Somogyi                          Contentedness is for sheep
MacUser

hawley@adobe.COM (Steve Hawley) (01/26/91)

In article <636@adimail.UUCP> tel@adimail.UUCP (Terry Monks) writes:
>   The problem is that when the system crashes and I reboot, the last few
>message files are not updated, and I can only assume it is because they
>are still cached. So I go to the control panel - memory - and note that
>disk cache is adjustable but is always on. Is there *any* way to turn
>it off?

Do you have a call to FlushVol() after you have updated a file?  It was my
impression that this guarantees that the file state on disk is consistent
with the file state in memory.

Steve Hawley
hawley@adobe.com
-- 
"Did you know that a cow was *MURDERED* to make that jacket?"
"Yes.    I didn't think there were any witnesses, so I guess I'll have to kill
 you too." -Jake Johansen

keith@Apple.COM (Keith Rollin) (01/29/91)

In article <38464@cup.portal.com> MacUserLabs@cup.portal.com (Stephan - Somogyi) writes:
>fry@zariski.harvard.edu (David Fry) writes about caching:
> 
>>That said, you will not leave information in the cache if you use the
>>file manager correctly: you should call FlushVol() periodically,
> 
>I remember someone telling me recently that regular FlushVolling
>doesn't necessarily guarantee the cache to be flushed.
> 
>Could someone please shed some light on this? Keith?
 
Oh, sure. Drag MY name into this...

You know, I'd also heard that FlushVolling didn't flush everything.
However, I traced through the code once, and it looks like it
flushes everything to me. At least, everything important. And
certainly everything pertaining to files.

-- 
------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc.  ---  Developer Technical Support
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions

palmer@nntp-server.caltech.edu (David Palmer) (01/29/91)

>fry@zariski.harvard.edu (David Fry) writes about caching:
[Or maybe the correct attribution is lost]
> 
>>That said, you will not leave information in the cache if you use the
>>file manager correctly: you should call FlushVol() periodically,

This may not be the best place to ask this, but the people who
read this group are the right people to ask.

Is there a utility, Init, cdev, whatever that replaces the Apple
'Hope the machine doesn't go down before this gets flushed' disk cache
with a write-through or write-in-background-but-promptly cache?

I'm just paranoid, but they _are_ out to get me :-).

-- 
		David Palmer
		palmer@gap.cco.caltech.edu
		...rutgers!cit-vax!gap.cco.caltech.edu!palmer
	"Operator, get me the number for 911"  --Homer Simpson

Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (02/01/91)

Keith Rollin writes in a message to All

KR> ou know, I'd also heard that FlushVolling didn't flush everything. 
KR> However, I traced through the code once, and it looks like it 
KR> flushes everything to me. At least, everything important. And 
KR> certainly everything pertaining to files

It may not flush everything pertaining to FinderInfo...


Lawson
 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English
Internet: Lawson.English@p88.f15.n300.z1.fidonet.org

keith@Apple.COM (Keith Rollin) (02/03/91)

In article <11958@goofy.Apple.COM> Greg@AppleLink.Apple.Com (Greg Marriott) writes:
>In article <1075.27AA0D8A@stjhmc.fidonet.org>, Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) writes:
>> 
>> Keith Rollin writes in a message to All
>> 
>> KR> You know, I'd also heard that FlushVolling didn't flush everything. 
>> KR> However, I traced through the code once, and it looks like it 
>> KR> flushes everything to me. At least, everything important. And 
>> KR> certainly everything pertaining to files
>> 
>> It may not flush everything pertaining to FinderInfo...
>
>It does.

Thanks for clearing that up, Greg. It looks like Lawson is referring
to the times when one crashes, and things like Finder windows open up
in an old formation.

Trying to analyze why that's so from the outside, you can come up with
two possible reasons for this:

1) That the new information is not flushed to disk, or 
2) That the new information is not in the right place to be flushed
   to disk.

Given confirmation that the former is not true, I guess that the
problem lies in the caching that the Finder itself does. The Finder
normally caches all the information known as Finder Info in its own
data structures, and doesn't transfer them back into the appropriate
FCB's and VCB's until it absolutely had to. If it did this, then a
FlushVol would keep that information up-do-date. But it doesn't, so the
Finder has the habit of opening up windows in their old states.

-- 
------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc.  ---  Developer Technical Support
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions