[comp.sys.mac.programmer] Another Puzzle

ts@cup.portal.com (Tim W Smith) (02/24/89)

Here's another puzzle.  Suppose you have a computer with a SCSI disk
attached to that computer.  You observe the following behaviour:

	You attempt to find the SCSI id of the disk by doing
	INQUIRY commands on id's 0 to 6.  The disk responds
	to ALL of these.

	You reset the SCSI bus and do an inquiry on id 0.
	You get a unit attention condition.  You do another
	inquiry and get the correct inquiry data.

	You now do an inquiry to id 1.  You get a unit attention
	condition.

What's going on?

						Tim Smith

ps: anyone else have any weird things like this that would make interesting
puzzles?

alexis@ccnysci.UUCP (Alexis Rosen) (02/26/89)

In article <15030@cup.portal.com> ts@cup.portal.com (Tim W Smith) writes:
>[describes very weird disk behavior]
>What's going on?

Gee. Maybe your disk isn't working?  :-)

>ps: anyone else have any weird things like this that would make interesting
>puzzles?

Just out of curiosity, these aren't just hypothetical questions, are they?
What are you doing that causes all this weirdness, anyway? This has got to
be the most obscure question I've seen on this group in ages...

Alexis Rosen
alexis@ccnysci.uucp

ts@cup.portal.com (Tim W Smith) (02/27/89)

Here is the other puzzle I posted a few days ago:

< Here's another puzzle.  Suppose you have a computer with a SCSI disk
< attached to that computer.  You observe the following behaviour:
< 
< 	You attempt to find the SCSI id of the disk by doing
< 	INQUIRY commands on id's 0 to 6.  The disk responds
< 	to ALL of these.
< 
< 	You reset the SCSI bus and do an inquiry on id 0.
< 	You get a unit attention condition.  You do another
< 	inquiry and get the correct inquiry data.
< 
< 	You now do an inquiry to id 1.  You get a unit attention
< 	condition.
< 
< What's going on?

The problem is that disk drive and the computer are both set to the
same SCSI id.  The way an initiator selects a target on SCSI goes
something like this:

	Initiator grabs the bus

	Initiator turns on bits X and Y of the data bus, where X
	is the initiator id and Y is the target id ( this is why
	there is a limit of 8 devices: each one needs a bit on
	the data lines for selection ).  Initiator also turns on
	a line that says "Hey you!  I'm selecting you!"

	Target device sees that initiator is selecting someone.  It
	looks at the data bus to see if it is the device being
	selected.  If it is, it also looks to see what initiator
	is doing the selection.

Well, suppose both devices are set to id 7.  When the initiator tries
to select device X, it will turn on bits 7 and X.  The target device
will look at the bus and see bit 7 on, so it thinks it is being selected.
It will see bit X on and thing that the initiator has id X.

Thus, from the point of view of the initiator, the target appears to
respond to all id's that are not 7.

This explains the first part of the puzzle.

To understand the second part of the puzzle, you need to be
aware that SCSI devices keep seperate status for each initiator.


Now we can explain the second part.  First, you do a reset of the SCSI
bus.  The target goes into a unit attention condition.

The inquiry on id 0 gets a unit attention.  The target thinks that the
initiator had id 0, so it clears unit attention for initiator 0.

The next inquiry on id 0 works fine, because the first cleared the
unit attention condition.

When you do the unit attention on id 1, the target thinks that the
command is being issued by initiator 1, which has not yet done any
command since the reset, so it gets a unit attention.


						Tim Smith

joseph@cooper.cooper.EDU (Joe Giannuzzi) (03/01/89)

in article <15030@cup.portal.com>, ts@cup.portal.com (Tim W Smith) says:
> 
> 	You attempt to find the SCSI id of the disk by doing
> 	INQUIRY commands on id's 0 to 6.  The disk responds
> 	to ALL of these.
> 
	I believe this will happen if the SCSI id of the disk is set
	to 7.  (For instance, Jasmine drives have a switch for 0-7)
	I know that when the Jasmine drive id was accidentally set
	to 7, 7 identical and accessible copies (id's 0-6) of the
	drive appeared on the desktop.

	Joe Gunoz	joseph@cooper.cooper.edu